如何使用jquery向下滚动当前屏幕?

时间:2014-06-11 10:36:24

标签: jquery scroll

我正在开发像agentur-loop.com这样的项目。 我想知道当前屏幕是如何关闭的,而不是整个页面。

1 个答案:

答案 0 :(得分:0)

您可以创建一个函数,然后像这样使用它:

$(function () {

      $("li").click(function(){
       scrolView(this.id);

          });
   });

功能:

function scrolView(i) {
           $('div').each(function () {
               if (($(this).attr('id'))==i) {
                   $('html, body').animate({
                       scrollTop: $(this).offset().top
                   }, 1000);
               }
           });
       }

FIDDLE EXAMPLE