Thank you! I'll have a go when I get home later today and let you know how it works out. At the very least you've given me a very big starting block, and perhaps this will end up in the jQuery core!
On Apr 18, 2:34 am, alexander farkas <i...@corrupt-system.de> wrote: > You can try the following code for this (only testet with firefox). > > (function($){ > var contains = document.compareDocumentPosition ? function(a, b){ > return a.compareDocumentPosition(b) & 16; > } : function(a, b){ > return a !== b && (a.contains ? a.contains(b) : true); > }, > oldLive = $.fn.live, > oldDie = $.fn.die; > > function createEnterOutFn(fn){ > return jQuery.event.proxy(fn, function(e) { > > if( contains(e.relatedTarget, this) ){ > e.type = (e.type == 'mouseover') ? > 'mouseenter' : 'mouseleave'; > //console.log('e') > fn.apply(this, arguments); > } > }); > } > > $.fn.live = function(type, fn){ > if(/mouseenter|mouseleave/.test(type)){ > console.log('d') > fn = createEnterOutFn(fn); > if(type == 'mouseenter'){ > type = 'mouseover'; > } else { > type = 'mouseout'; > } > } > > oldLive.call(this, type, fn); > }; > > $.fn.die = function(type, fn){ > if(/mouseenter|mouseleave/.test(t.type)){ > if(type == 'mouseenter'){ > type = 'mouseover'; > } else { > type = 'mouseout'; > } > } > oldDie.call(this, type, fn); > }; > > })(jQuery); > > you can use it like the normal live/die-methods: > > $('a').live('mouseenter', function(e){ > console.log(e.type)}); > > $('a').live('mouseleave', function(e){ > console.log(e.type) > > }); > > but i would call it a plugin: > > On 11 Apr., 21:36, Walther <waltherl...@gmail.com> wrote: > > > I am looking for a way to simulate the actions of the hover (or > > mouseenter/mouseleave) whilst using the live method of binding (The > > items are dynamic). > > > Is there a way to do this or will I need to use the 'old fashioned' > > method of unbinding and rebinding? I do not want to use a plugin. > >