Opposite of “scrollTop” in jQuery

前端 未结 8 959
情深已故
情深已故 2020-12-14 08:04

jQuery has a function called scrollTop which can be used to find the number of pixels hidden above the current page view.

I\'m not really sure why, but there is no s

8条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-14 08:31

    If you want to Scroll Down (Opposite of “scrollTop”), try to use the vertical position on the argument. Like this:

    $(document).ready(function(){
        $("button").click(function(){
                               //position on pixeles
            $("body").scrollTop(1300);
        });
    });
    

    The top of the body, will be: $("body").scrollTop(0);

提交回复
热议问题