页面加载时 jquery 向下滑动
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8702912/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
jquery slidedown on page load
提问by Aol Shqip
How can slide down a div with jquery on page load where css is set to display:none? I see a lot of solutions but none can slide div if css is set display:none. The best way is to hide it on load and after slidedown but the div have flash (show) when page is loading.
如何在页面加载时使用 jquery 向下滑动 div,其中 css 设置为 display:none?我看到了很多解决方案,但如果 css 设置为 display:none,则没有一个可以滑动 div。最好的方法是在加载时和滑下后隐藏它,但是当页面加载时 div 有闪光(显示)。
回答by john
回答by dku.rajkumar
$('#hidden_div_id').slideDown('slow');
this internally make use of display:block
这在内部利用 display:block
回答by Wasim A.
I didn't found above as working solution. So here it is http://www.robertprice.co.uk/robblog/using-jquery-to-scroll-to-an-element/
我没有在上面找到工作解决方案。所以这里是http://www.robertprice.co.uk/robblog/using-jquery-to-scroll-to-an-element/
$('html, body').animate({
scrollTop: ($('#element').offset().top)
},500);