Beginners questions (scrollbars and more)

Discussion in 'Javascript' started by January Weiner, Aug 10, 2009.

  1. Hello all,

    I am fairly new to ECMAscript/Javascript. I am developing an app which
    allows the user to scroll an "infinite" image horizontally. The image is
    provided by a CGI script in chunks (say, PNGs of size 600x200 px). The
    whole image would have been way to large to load it in one go, not to
    mention the size of the associated imagemap.

    The whole point of involving ECMAscript for me is to get a smooth
    animation. This is how I do it: I load three images initially, but the one
    on the left and the one of the right are hidden by whitescreens (div
    elements with fixed position and background color set to white). The left
    one has negative position and is off the document page.

    When the image has to be scrolled -- say, to the left -- I call an
    animation function that slowly moves the images to the left. When the
    animation is done, I request (using XMLHttpRequest / Microsoft.XMLHTTP) the
    following (fourth image) and insert it into a fourth image slot (on the
    right). Then I kill the left-most slot.

    It all runs actually much better than I expected at first, but there is a
    small problem. At the bottom of the window there is a scrolling bar that
    changes its size / position during the operation. This is because of the
    rightmost whitescreen, covering the rightmost image slot (that just sits
    there and waits to be displayed).

    What can I do about it? Or maybe the whole approach is flawed?

    Cheers,
    j.
     
    January Weiner, Aug 10, 2009
    #1
    1. Advertisements

  2. January Weiner meinte:
    Apply overflow: hidden on an appropriate container. It's a CSS problem,
    not a JS issue.

    Gregor
     
    Gregor Kofler, Aug 10, 2009
    #2
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.