views:

16

answers:

1

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 doesn't work... :( If I change the event for "hover" it will work (but only on mouseout... which I can't use). if I change the event for "click" it also works, just NOT "mouseover".

Any ideas?

+1  A: 

You may be having issues because mouseover isn't what .hover() uses, it also fires for children. To get the .hover() equivalent you need mouseenter which doesn't fire when entering a child, like this:

$('.fc-event').live("mouseenter",function(){
Nick Craver
I want it to fire when you mouse over the element regardless of the children. The problem isn't its not working a bit, its not working at all.Lets say I use `$('.fc-event').live("mouseover",function(){ alert("Hello"); });` that won't work either. It doesn't seem to be registering a mouseover event AT ALL, whereas that will alert if I change the event to hover.
Thomas Clayson
@Thomas - There's something outside your question going on then, possible a parent returning false or stopping propagation? The `mouseover` event itself works, you can test here: http://jsfiddle.net/nick_craver/DuxmJ/
Nick Craver
Nick - Unless I'm mistaken, `mouseenter` just gets mapped to `mouseover` anyway. http://github.com/jquery/jquery/blob/master/src/event.js#L934 I assumed this was because for a `.live()` effect to work, the event *would* need to fire for each descendant element.
patrick dw
@patrick - It's not about firing the the descendant though, it's about firing for the parents. You're correct on the remap if he's using 1.4.2 specifically, this didn't happen until then: http://github.com/jquery/jquery/blob/1.4.1/src/event.js#L867 Regardless, the problem isn't here, there's something external going on.
Nick Craver
Nick - You're right, not OP's issue. With regard to event firing, I just meant that a `mouseenter` placed on a container (like live() does) wouldn't fire when you `mouseenter` its children, so it would seem like a `mouseover` would be needed instead. Don't spend time on it. I'll look into it more. :o)
patrick dw
@Nick... its the fullcalendar for jquery plug in that was stopping my mouseover. I'm not sure how, and I couldn't take it out of the script - but theres a hook which adds a listener for the onMouseOver event on .fc-event divs. This will have to do. Thanks for your help. :)
Thomas Clayson