0
在jQuery中使用requirejs我面臨綁定事件調用方法的問題。具有下列代碼:在jquery綁定事件上的RequireJS不會觸發方法
define(["jquery"], function($) {
function showRowItem(item) {
console.log('method in');
}
jQuery(document).ready(function() {
jQuery('ul#topnav-firstrow li').each(function() {
jQuery(this).bind("mouseover", function (event) {
if (outTimerID != null) {
clearTimeout(outTimerID);
outTimerID = null;
}
globalMouseOverItem = this;
inTimerID = window.setTimeout("showRowItem(globalMouseOverItem)", inDelay);
});
});
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
當我將鼠標懸停在項事件被炒魷魚,但方法不承認
Uncaught ReferenceError: showRowItem is not defined
這裏是codepen http://codepen.io/deroccha/pen/WxQLoy再現錯誤
非常感謝,就是這樣! – deroccha