在使用.load更新我的div后,即将项添加到我的列表中,我使用了firebug并看到列表已更新.但是,我丢失了鼠标悬停事件,该事件在页面首次加载时起作用....在我的脚本中我有:
// hide and show are css classes that display none and block respectively
function openList(){
$("#miniList").removeClass().addClass("show");
}
function closeList(){
$("#miniList").removeClass().addClass("hide");
}
...
$(document).ready(function() {
$("#miniList").mouseover(function() {
openList();
})
$("#miniList").mouseout(function() {
closeList();
})
});
Run Code Online (Sandbox Code Playgroud)
function addItemToDiv(id, ref, num) {
$("#miniList").load("/list/ajax_updateList.jsp", {
'action' : 'additem',
'pid' : id,
'pref' : ref,
'qty' : num
});
}
Run Code Online (Sandbox Code Playgroud)
...当然,这在第一次加载页面时工作正常,但是当我将项目添加到列表时,DOM会更新,但鼠标悬停效果不再起作用.
任何想法都受到欢迎.提前谢谢了.