Offscreen image without scrollbars

Discussion in 'HTML' started by Jeff Adams, Oct 7, 2005.

  1. Jeff Adams

    Jeff Adams Guest

    I have a set of images that I'm moving around with javascript. When one of
    them moves off the screen a scrollbar appears. Is there a way to set it so
    that these images don't cause scrollbars to appear?

    Thanks
     
    Jeff Adams, Oct 7, 2005
    #1
    1. Advertising

  2. Jeff Adams

    Neredbojias Guest

    With neither quill nor qualm, Jeff Adams quothed:

    > I have a set of images that I'm moving around with javascript. When one of
    > them moves off the screen a scrollbar appears. Is there a way to set it so
    > that these images don't cause scrollbars to appear?


    Depends. Background images do not cause scrollbars... Also,
    overflow:hidden; styled on the container would prevent scrollbars from
    ever appearing.

    --
    Neredbojias
    Contrary to popular belief, it is believable.
     
    Neredbojias, Oct 7, 2005
    #2
    1. Advertising

  3. Jeff Adams

    Jeff Adams Guest

    > Depends. Background images do not cause scrollbars... Also,
    > overflow:hidden; styled on the container would prevent scrollbars from
    > ever appearing.
    >

    But can't you only have one background image? The problem with the overflow
    is that the page might have content that requires scrolling. I just don't
    want these specific images to cause scrolling
     
    Jeff Adams, Oct 7, 2005
    #3
  4. Jeff Adams

    Neredbojias Guest

    With neither quill nor qualm, Jeff Adams quothed:

    > > Depends. Background images do not cause scrollbars... Also,
    > > overflow:hidden; styled on the container would prevent scrollbars from
    > > ever appearing.
    > >

    > But can't you only have one background image?


    One per element, yes.

    > The problem with the overflow
    > is that the page might have content that requires scrolling. I just don't
    > want these specific images to cause scrolling


    Well, how many images are there? If you have 100, I doubt anything can
    be done. If you have just a few, something probably can be done. The
    first thing I would consider is combining the images graphically and
    making *it* the body background. If that isn't feasible, other methods
    may be useful.

    --
    Neredbojias
    Contrary to popular belief, it is believable.
     
    Neredbojias, Oct 7, 2005
    #4
  5. Jeff Adams

    Greg N. Guest

    Jeff Adams wrote:

    > I have a set of images that I'm moving around with javascript. When one of
    > them moves off the screen a scrollbar appears. Is there a way to set it so
    > that these images don't cause scrollbars to appear?


    Have a look at the site in my sig, there are lots of pages with images
    that exceed the window without scrollbars, for example this page:

    http://hothaus.de/greg-tour-2004/ionia.htm

    --
    Gregor's Motorradreisen:
    http://hothaus.de/greg-tour/
     
    Greg N., Oct 7, 2005
    #5
  6. Jeff Adams

    Toby Inkster Guest

    Jeff Adams wrote:

    > But can't you only have one background image?


    Only one per element, yes.

    Try:

    <img src="foo.jpeg" alt="Foo" height="100" width="160" id="imgfoo">
    <img src="bar.jpeg" alt="Bar" height="100" width="160" id="imgbar">

    <script type="text/javascript">
    function img2bg (i)
    {
    var e = document.getElementById(i);
    var f = e.src;
    e.src = null;
    e.title = e.alt;
    e.alt = '';
    e.style.backgroundImage = "url(" + f + ")";
    }
    img2bg("imgfoo");
    img2bg("imgbar");
    </script>

    The img2bg() function above takes a regular image, blanks it out and then
    replaces it with a background image.

    Example: http://examples.tobyinkster.co.uk/img2bg

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
     
    Toby Inkster, Oct 8, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. thomas
    Replies:
    17
    Views:
    13,849
    Nico Schuyt
    Sep 18, 2003
  2. Erick Crouse
    Replies:
    0
    Views:
    386
    Erick Crouse
    Mar 27, 2008
  3. rf
    Replies:
    1
    Views:
    418
    Harlan Messinger
    Apr 6, 2008
  4. mrcakey
    Replies:
    0
    Views:
    436
    mrcakey
    Apr 7, 2008
  5. Replies:
    1
    Views:
    166
    Laurent Bugnion [MVP]
    Feb 5, 2007
Loading...

Share This Page