Actually, I need to make some changes... I wasn't correctly setting the events object to the new order.
On Mar 29, 5:23 pm, sliver <sliver2...@gmail.com> wrote: > Thanks Eric! > > I made some adjustments to your code (to make it a bit more readable > for me and to essentially just splice in the bound function to the > stack in the desired location). > > You can check out the changes > here:http://snipplr.com/view/13556/jquery-event-stack-binder/ > > On Mar 27, 10:19 pm, Eric Garside <gars...@gmail.com> wrote: > > > Yea, it swaps positions and the latest element will always move to the > > end of the stack, so you have knowledge of its position. > > > On Mar 27, 9:12 pm, mkmanning <michaell...@gmail.com> wrote: > > > > Eric, > > > > Nice work! > > > > I just did a quick test and it appears that once the override event is > > > inserted into the stack, it bumps the event it's replacing to the end. > > > That is, if I insert it at position 0, and then unbind it, the event > > > firing order is now 2,3,4,1. Same if I insert it into position one, > > > events are then restored to 1,3,4,2. > > > > Michael > > > > On Mar 27, 4:38 pm, Eric Garside <gars...@gmail.com> wrote: > > > > > I've come up with a little plugin that will allow you to bind any > > > > event (including custom ones) into a specified position in the event > > > > stack. > > > > >http://snipplr.com/view/13515/jstack--jquery-event-stack-management/ > > > > > The plugin is currently very basic and only allows you to insert a new > > > > event into a certain position in the stack. The logic is there for > > > > this plugin to do more, and I'll probably make it a bit more robust > > > > later, but this current version of the plugin should allow you to do > > > > what you need for your project. > > > > > I added some demo testing stuff at the bottom to demonstrate how it > > > > should function. You'll need a browser with console.log() capabilities > > > > to get the gist of things. > > > > > Also, a few quick notes: > > > > * You can bind custom events, regular events, and custom and regular > > > > events with namespaces (which I suggest you use to help in unbinding) > > > > * If you attempt to put an event at a certain position in the call > > > > stack, and that position doesn't exist (i.e., you attempt to bind a > > > > new click event to the 5th position in a stack of 3 elements), it will > > > > just bind the event regularly. > > > > * The stack is zero-indexed, meaning the first element in the stack > > > > is position 0, not position 1. > > > > * The demo text at the bottom is using a custom event "clickr" with > > > > some namespaces for testing. This was just to confirm that the plugin > > > > worked for custom events as well. If you make all the "clickr" events > > > > click, and unbind the click event which triggers clickr events, you > > > > will get the same result. > > > > > Hope you find it useful! Let me know if you run into any issues. > > > > > On Mar 27, 3:54 pm, deltaf <j...@deltafactory.com> wrote: > > > > > > It's potentially a pain, but if you know all of the events bound to > > > > > it, you could unbind, add your event, then add all of the others. > > > > > > I too wish there was an easy way to view/modify the event stack... > > > > > > Best of luck.