在JQuery中,slideDown()方法也可以将页面向下滚动吗? [英] In JQuery is there way for slideDown() method to scroll the page down too?

查看:76
本文介绍了在JQuery中,slideDown()方法也可以将页面向下滚动吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

应用于div的slideDown可以进行slideDown,但不会向下滚动页面,向下滑动的div仍不可见.有没有一种方法可以向下滚动页面,以便用户可以查看div?

The slideDown applied to a div does the slideDown but doesn't scroll the page down and the div slided down div remains hidden from view. Is there a way to scroll the page down as well so the user can view the div?

推荐答案

快速演示此处

基本上您需要的是

 $('html, body').animate({ 
      scrollTop: $('#yourDiv').offset().top 
  }, 3000); 

这篇关于在JQuery中,slideDown()方法也可以将页面向下滚动吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆