jquery live(),鼠标悬停不起作用

时间:2010-09-01 11:59:28

标签: jquery live mouseover

HI那里

这是我的代码

$('.fc-event').live("mouseover",function(){
                                    if (!$(this).data("init")) {
                                        $(this).data("init", true);
                                        $(this).draggable({ 
                                             appendTo: 'body', 
                                             //opacity: 0.65, 
                                             revert: 'invalid', 
                                             scroll: true, 
                                             scrollSpeed: 50 
                                             });
                                        $(this).draggable(
                                            "option",
                                            "helper",
                                            function(){
                                                $('body').append('<div id="dragElement"></div>');
                                                $('#dragElement').maxZIndex({inc : 5});
                                                $('#dragElement').html($(this).find('.fc-event-title').html());
                                                return $('#dragElement'); 
                                            });
                                    }
                                });

这不起作用...... :(如果我更改“悬停”事件它将起作用(但仅限于鼠标输出...我不能使用)。如果我更改“点击”事件它也有效,只是没有“鼠标悬停”。

有什么想法吗?

1 个答案:

答案 0 :(得分:3)

您可能遇到问题,因为mouseover不是.hover()使用的问题,而且也会触发儿童。要获得.hover()等效项,您需要{em> 在进入孩子时需要mouseenter,例如:

$('.fc-event').live("mouseenter",function(){