next() is a sibling selector. Since it is contained within content div it will only interact with elements within content

testing for length is a very handy method.

if( $(this).next().length==0) {  // will return true if at bottom, would have to test after the animation, or use length==1 if test before animation
// $("yourDownArrow").hide()
}

Abbey wrote:
Hello,

I have basic js knowledge, and just started playing with jQuery.

I am doing an experiment where when you click an UP/DOWN ARROW link,
the box will slide up/down throughout the page.

I found a generic swap function online and modified it for jQuery use.
Now I want to refine it more.

I'd like to:
1) When the box is under the HEADER make the UP ARROW disappear,
because we don't want this box to go farther than  that.
2) Same when the box is above the FOOTER, make the DOWN ARROW
disappear so it won't go down anymore on the page.

Here is my test page: http://bit.ly/7uN0ly

The jQuery code is at the bottom if you view the source.

Additional Notes:
I know I can make the ARROW disappear if I add $(this).css
("visibility","hidden");

How come I can't do $(this).parents().prev("div").is("#footer") to
detect the footer div?

The header will always be the first div inside the body, the footer
will always be the last div inside the body.

Thanks for any help! I'm just stuck trying to detect these edge divs.
~Abbey

  

Reply via email to