I’ve made this example in jsfiddle to demonstrate my problem: http://jsfiddle.net/paulmason411/7E6vG/
See how the grey class is added and yet it doesn’t apply the left margin when u hover a second time. I’m guessing this is because the $('.block.grey') selector is declared before the class is grey class is added.
Is there anyway I can get the $('.block.grey') selector to re-parse the dom after the class is added?
Any help would be great, cheers!
EDIT:
I have a more complicated example
$('.accordion h3').not('.ui-state-active').find('a').live('hover', function(){
Where the ui-state-active class is added dynamically. bitsMix has pointed out that this code is making the a live. So I’ve updated it to
$('.accordion h3').live('hover', function(){
$(this).not('.ui-state-active').find('a').stop().animate({
and it works! Thanks guys!
you need to add live to the like this:
fiddle