[英]Scroll down window when toggle open
嗨,我在一个在页脚下创建了“切换部分”的网站上工作,但是问题是当切换打开时,窗口无法滚动到该切换部分,这就是人们看不到它的原因。 我想要的是,当单击切换按钮将其打开时,切换打开的窗口应自动滚动到该部分。
这是我一直在使用的Js代码;
<script>
jQuery(document).ready(function(){
jQuery('#hideshow').live('click', function(event) {
jQuery('#ticket-content').toggle('show');
});
});
</script>
网站在这里; 点击这里进入网站
希望很快能对您有所帮助。
提前致谢。
尝试这个。 我可以帮你。
jQuery(document).ready(function(){
jQuery('#hideshow').live('click', function(event) {
jQuery('#ticket-content').toggle('show',function() {
jQuery('html, body').animate({
scrollTop: jQuery(this).offset().top
}, 2000);
});
});
});
尝试:
jQuery(document).ready(function(){
jQuery('#hideshow').live('click', function(event) {
jQuery('#ticket-content').toggle(function(){
jQuery('html, body').animate({
scrollTop: jQuery(this).offset().top
}, 2000);
});
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.