Why not make sure that the e.target is equal to the active element before
re-firing the event?

if ( e.target === this ) {
  // your code
}

--John


On Wed, Jul 15, 2009 at 3:39 PM, Jeffrey Kretz <jeffkr...@hotmail.com>wrote:

>
> I hate to bump this, but I haven't yet been able to figure out a solution
> --
> I'm hoping someone knows of a way to accomplish this result.
>
> Thanks,
> JK
>
> -----Original Message-----
> From: jquery-dev@googlegroups.com [mailto:jquery-...@googlegroups.com] On
> Behalf Of Jeffrey Kretz
> Sent: Tuesday, July 14, 2009 7:12 PM
> To: jquery-dev@googlegroups.com
> Subject: [jquery-dev] Help with jQuery.event.trigger
>
>
> I'm posting this to the dev list in hopes that someone here may know of a
> better pattern for what I'm trying to do.  A change with the
> jQuery.event.trigger method (between 1.2.x and 1.3.x) has affected a plugin
> I wrote, and I'm trying to find a solution.
>
> ----------------------------------------
>
> I have a custom color picker which has broken since I upgraded from 1.2.6
> to
> 1.3.2.
>
> I've traced the problem to a change in how events are bubbled.  There's
> probably an easy fix, but I'm not sure what it would be.
>
> I have a hue slider with a hue indicator inside it.  The indicator is a
> draggable, and the hue updates on drag.  That works fine.
>
> The slider itself has a mousedown event that moves the hue indicator the
> clicked position.  This also works fine.
>
> The slider (parent) mousedown event then triggers the indicator (child)
> mousedown event.  This is what is broken.  What I'm trying to do, is when
> the user does a mousedown on the slider, I want the indicator to not only
> move to that position, but be draggable immediately without having to
> release the mouse and click on the same spot.
>
> The specific problem is this:
>
> 1. The slider triggers the mousedown event on the indicator.
> 2. The indicator draggable initializes.
> 3. The indicator's mousedown.draggable event does not cancel propagation.
> 4. The jQuery trigger event then bubbles up to the parent (the slider).
> 5. Which then re-fires the indicator mousedown event.
> 6. Infinite loop.
>
> It seems that there must be a better pattern that allows me to trigger the
> child element's draggable without causing this loop.
>
> Does anyone have any suggestions?
>
> JK
>
>
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to