0
以下功能在我的浏览器的控制台窗口中抛出一个错误页面加载时:引导3 jQuery的偏移JavaScript错误
function getRight() {
return ($(window).width() - ($('[data-toggle="popover"]').offset().left + $('[data-toggle="popover"]').outerWidth()))
}
错误:
Uncaught TypeError: Cannot read property 'left' of undefined
at getRight (application.js:12)
at HTMLDocument.<anonymous> (application.js:30)
at j (jquery.js:3099)
at Object.fireWith [as resolveWith] (jquery.js:3211)
at Function.ready (jquery.js:3417)
at HTMLDocument.I (jquery.js:3433)
getRight @ application.js:12
(anonymous) @ application.js:30
j @ jquery.js:3099
fireWith @ jquery.js:3211
ready @ jquery.js:3417
I @ jquery.js:3433
该页面加载此jQuery的:
https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
你运行在DOM准备的代码? – gaetanoM