有人可以帮助我克服这个错误吗?
这是脚本:
// usefull for select for example
$.fn.scrollTo = function(elem) {
$(this).scrollTop($(this).scrollTop() - $(this).offset().top + $(elem).offset().top);
return this;
};
这是错误:
materialize.js:429 Uncaught TypeError: Cannot read property 'top' of undefined
at m.fn.init.$.fn.scrollTo (materialize.js:429)
at activateOption (materialize.js:2731)
at HTMLInputElement.<anonymous> (materialize.js:2720)
at HTMLInputElement.dispatch (VM44 jquery-1.11.2.min.js:3)
at HTMLInputElement.r.handle (VM44 jquery-1.11.2.min.js:3)