[英]How to scroll page to the element with Jquery ScrollTo() using class selector?
基于这个问题,我想问一个问题:如何使用类选择器$('.class')
解决相同的问题?
我收到Uncaught TypeError: undefined is not a function
当试图运行这个
$('html, body').animate({
scrollTop: $('input.ng-invalid').offset().top
}, 2000);
尝试这个
var sc = $('div[class="classname"]').offset().top;
$('body,html').animate({
scrollTop: (sc - 30)
},
'slow');
我不确定,但这就是你想要的吗? http://jsfiddle.net/65q6xo95/1/
$('html, body').animate({
scrollTop: $('.ng-invalid:first').offset().top
}, 2000);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.