JQuery live () does not work with the manipulator

Hi there

This is my code.

$('.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'); 
                                            });
                                    }
                                });

This will not work ... :( If I change the event for "hover", it will work (but only on mouseout ... which I cannot use). If I change the event for "click" it also works, just NOT "mouse".

Any ideas?

+3
source share
1 answer

You may have problems, because mouseovernot that .hover(), it also runs for children. To get the equivalent .hover(), you need mouseenterone that does not work when entering a child, for example:

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

Source: https://habr.com/ru/post/1762642/


All Articles