Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使用Jquery向下滚动?_Javascript_Jquery_Html_Css - Fatal编程技术网

Javascript 如何使用Jquery向下滚动?

Javascript 如何使用Jquery向下滚动?,javascript,jquery,html,css,Javascript,Jquery,Html,Css,实际上,我正在使用下面的代码在顶部滚动 var container = $('#items_suggession_right'), scrollTo = $(".selected"); container.animate({scrollTop: scrollTo.offset().top - container.offset().top + container.scrollTop()}, 0); 但我不能滚动设置在底部。请帮助

实际上,我正在使用下面的代码在顶部滚动

 var container = $('#items_suggession_right'), scrollTo = $(".selected");
         container.animate({scrollTop: scrollTo.offset().top - container.offset().top +
                       container.scrollTop()}, 0); 
但我不能滚动设置在底部。请帮助我使用jquery设置底部滚动,您可以使用

var time = 0; // in milliseconds
$("html, body").animate({ scrollTop: $(document).height() }, time);.

您可以增加“时间”值,以提供更平滑、更具动画效果的底部滚动。

提供以下代码以滚动到页面底部

container.animate({ scrollTop: $(document).height() }, 0);
希望有帮助

$(document).ready(function() {

    $('#buttonID').click(function(){
        $('html, body').animate({scrollTop:$(document).height()}, 'slow');
        return false;
    });

});
只需使用此代码部分。

您可以使用:

$('html').animate({ scrollTop: $(document).height() }, 1000);
$document.readyfunction{ $'html,body'。设置动画{ 滚动顶部:$'.testwrap'.height }, 800; }; .testwrap{ 宽度:500px; 高度:1000px; 边框:2个点c00; }
可能重复欢迎使用堆栈溢出!虽然此代码可能有助于解决问题,但它没有解释为什么和/或如何回答问题。提供这种额外的环境将大大提高其长期教育价值。请编辑您的答案以添加解释,包括适用的限制和假设。
$('html').animate({ scrollTop: $(document).height() }, 1000);