【发布时间】:2016-06-25 08:12:22
【问题描述】:
我的以下代码在 Chrome 中运行良好,但在 Safari 中出现以下错误。有什么办法可以解决吗?
jQuery('.mk-responsive-nav > li > a').click( function() {
var href = jQuery(this).attr('href').replace('#', '');
jQuery(window).scrollTop( jQuery("section[data-anchor='" + href + "']").offset().top );
console.log( jQuery("section[data-anchor='" + href + "']").offset().top );
});
Safari 错误:
TypeError: undefined is not an object (evalating 'jQuery("section[data-anchor='" + href + "']").offset().top')
【问题讨论】:
标签: javascript jquery ios safari scrolltop