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