Results 1 to 2 of 2

Thread: problem with anchored links outside of the scrollable layer

  1. #1
    Join Date
    Jan 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default problem with anchored links outside of the scrollable layer

    Hi, I'm new to this forum, but I hope you guys will be kind enough to help me solve this problem I'm having.

    What I'm trying to accomplish:
    I am using Project Seven (PVII)'s Layer AniMagic to create a scrollable content layer one can scroll up or down using an up/down arrows. Outside of this scrollable content are links that are anchored to contents within the scrollable layer. What I would like for it to happen is when a user click on the links the content should jump down to appropriate positions, the user should then have the option of being able to scroll back up using the faux scrollbar (up/down arrows).

    The problem:
    When the user clicks on the anchored links, the content drops down to appropriate position but does not offer the option of scrolling back to top using the up arrow. I believe this is because Layer AniMagic works by counting down pixels when down arrow is depressed then count back up to 0 when the up arrow is pressed (I think majority of the scroll scripts I looked at have similar algorithm). When the content jumped down to the anchored position, the script did not get its chance to count down and thus believe that the anchored position is still at 0.

    What I've tried/considered:
    - iframe. This will not do because the scrollbar uses the browser scrollbar (it has to be up/down arrows).
    - I've fooled the Layer AniMagic code to thinking that it starts at -5000 (instead of 0), this worked by fooling it to allow scroll back up but it does not automatically stop the scrolling at 0 as it should, instead allows the user to scroll up to -5000, making it look sloppy.
    - I've looked into different scripts, but none of them supported anchored links positioned out of the layer.

    Has anyone run into problem like this? Any suggestions?

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I would look into finding where in the script the position of the layer is kept. Most likely this would be some variable named something like 'scrollPos' or whatever, it could be any unique (hopefully descriptive) name. Now, this position will be stored either as an integer or as a number of pixels like 20px. Most likely an integer. Also, it is likely that the 'Layer' (a division probably) position corresponds to its scrollTop property. So, lets say this layer is a division with an id of say, 'scroller', you could set the variable I mentioned earlier by this element's scrollTop value a moment or so after each anchor link is clicked using this type of link:

    Code:
    <a href="anchor_name" onclick="return updatePos();">Anchor Description</a>
    and a function like so:

    function updatePos(){
    setTimeout("scrollPos=document.getElementById('scroller').scrollTop", 75);
    return true;
    }

    Note: For this to work, scrollPos (or whatever this variable is actually called) would need to be a global variable in the original script or converted into one.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •