0

I have a scrollable div with and arrow above and an arrow below. What I am trying to do is to make the arrow above appear after the div has reached a certain height.

here is the code that I have...

$("#scrolldivup").hide();
$(.section).scroll(function(){
          if($(.section).scrollTop()>1){
                $("#scrolldivup").fadeIn();
             }
             else
             {
                $("#scrolldivup").fadeOut();
             }
    });

".section" is the scrollable div So as soon as it scrolls more than 1 pixel I want the "#scrolldivup" to appear which by the way is an anchor tag.

Can anyone see how my code is wrong?

Chris Jenks
  • 33
  • 1
  • 6
  • jquery lazy loader : http://stackoverflow.com/questions/5117421/how-to-load-images-dynamically-or-lazily-when-users-scrolls-them-into-view – diEcho Jun 11 '13 at 08:44

2 Answers2

1

Try this

$("#testdiv").hide();
 $(".section").scroll(function(){
      if($(".section").scrollTop()>1){
            $("#scrolldivup").fadeIn();
         }
         else
         {
            $("#scrolldivup").fadeOut();
         }
 });
Amit
  • 14,671
  • 8
  • 41
  • 63
1

$(.section) should be $('.section')

TheGwa
  • 1,909
  • 26
  • 43