Jquery没有';我不想改变DOM
在这一页的多天节日 我添加了以下JS 例如,将鼠标悬停的时间延长到跨越一周以上的节日 它适用于第一页,但当我更改月份时,它就不起作用了 在不同线程上寻找解决方案,例如此链接 我修改了实现“委托事件处理”的原始代码,但我的代码仍然只能在第一页中使用Jquery没有';我不想改变DOM,jquery,delegates,Jquery,Delegates,在这一页的多天节日 我添加了以下JS 例如,将鼠标悬停的时间延长到跨越一周以上的节日 它适用于第一页,但当我更改月份时,它就不起作用了 在不同线程上寻找解决方案,例如此链接 我修改了实现“委托事件处理”的原始代码,但我的代码仍然只能在第一页中使用 我还遗漏了什么吗?我通过使用修复了您的问题,就像在评论中建议的那样 但是奇怪的是。。。似乎您对mouseenter和mouseover事件还有另一个问题。我想他们可能在什么地方被阻止了。我不能说 我使用了mousemove事件使其工作 我是直接在
我还遗漏了什么吗?我通过使用修复了您的问题,就像在评论中建议的那样 但是奇怪的是。。。似乎您对
mouseenter
和mouseover
事件还有另一个问题。我想他们可能在什么地方被阻止了。我不能说
我使用了mousemove
事件使其工作
我是直接在控制台上做的。首先,我分离了您拥有的事件处理程序:
jQuery('.fc-event-hori').off('mouseenter');
jQuery('.fc-event-hori').off('mouseleave');
jQuery('.fc-event-hori').off('mouseover');
然后我输入了这个处理程序代码:
jQuery('.fullcalendar').on('mousemove mouseleave','.fc-event-inner', function(e){
// Get the text.
var x = jQuery(this).find('.fc-event-title').text();
console.log(e.type);
// Depending on the event, choose a color.
if(e.type=="mousemove"){
color="#fccd45";
}else{
color="#15242a";
}
// Use the text to lookup for the matching elements.
jQuery(".fc-event-inner:contains("+x+")").css("background",color);
});
它工作得很好
现在,如果我是你,我会尝试找出是否有一个.preventDefault()
some应用于这些事件。。。可能不是。。。但我会看看。我将使用搜索所有文件
然后,我希望升级jQuery版本。您当前使用的是1.7.2,在我看来它已经很旧了。升级时有一些帮助。请阅读尝试将$(文档)与eventjQuery(文档)一起使用。在('.fc event hori',mouseenter',function(){@louyspatricebesette:有JS的链接,不是吗?我想我的问题不会那么混乱:(.对不起我的误解…@SanjayKumar:我试过你的解决方案,但在第一页也不起作用:D
jQuery('.fullcalendar').on('mousemove mouseleave','.fc-event-inner', function(e){
// Get the text.
var x = jQuery(this).find('.fc-event-title').text();
console.log(e.type);
// Depending on the event, choose a color.
if(e.type=="mousemove"){
color="#fccd45";
}else{
color="#15242a";
}
// Use the text to lookup for the matching elements.
jQuery(".fc-event-inner:contains("+x+")").css("background",color);
});