2

This script for scroll to top, how can i change to scroll down.

This is my script:

$(document).ready(function(){

//Check to see if the window is top if not then display button
$(window).scroll(function(){
    if ($(this).scrollTop() > 100) {
        $('.scrollToTop').fadeIn();
    } else {
        $('.scrollToTop').fadeOut();
    }
});

//Click event to scroll to top
$('.scrollToTop').click(function(){
    $('html, body').animate({scrollTop : 0},800);
    return false;
});
});
Faizzul Hariz
  • 81
  • 1
  • 9
  • 3
    Possible duplicate of http://stackoverflow.com/questions/1890995/jquery-scroll-to-bottom-of-page-iframe and http://stackoverflow.com/questions/4249353/jquery-scroll-to-bottom-of-the-page – lmgonzalves Jun 17 '15 at 03:53

2 Answers2

0

This would animate the window to the bottom of the page using jQuery

 $("html, body").animate({ scrollTop: $(document).height() }, 1000);
AlphaG33k
  • 1,588
  • 1
  • 12
  • 24
0

You can try this

$("#DIV1").animate({
    scrollTop: $('#DIV2').offset().top - $("#DIV1").offset().top + $("#DIV1").scrollTop()-80
},800);

Here DIV2 is the DIV that u want to scroll and DIV1 is where u want to scroll .

By changing value 80 to different values u can scroll at any position

To scroll up or down increase or decrease value..

Hope works for u

Mayur Patel
  • 1,741
  • 15
  • 32