Open leconcepteur opened 12 years ago
i believed it was a bug at first. but in fact no. at least this is what i intended to code.
tQuery('cube').on('mouseover', function(){}
tQuery('cube')
means select all the cube of the existing scene. and .on()
mean binding the event. so it bind the event on the current elements, not on the ones which will be created in the futur.
i looked at jQuery .live() and apparently it got deprecated. http://api.jquery.com/live/
how to reproduce the former .live() code with .on() on jQuery ? one of the goal of tQuery is to reproduce jQuery api. so if tQuery.Object3D.on() doesnt match. lets change it :)
.on() seems to be live all the time, isnt it ?
btw .live() typeof behavior is achievable with events bubbling. it is currently supported
There's probably something I'm not aware of. Is there a way to not have to bind my existing events to the new objects?
Here's an example. We can see the ID of the cube created before the event when we hover the mouse, but it's not working with the cubes we add to the scene. http://jsfiddle.net/kuHHg/13/