I'm trying to run hover but only if a given element has certain class.
For exaple:
jQuery
$("#banner").hover(
if ($(this).hasClass("bannerReady")) {
function() {
runOne();
},
function() {
runTwo();
}
}
);
But this won't work.
I've tried using it like this and this will work, but then jQuery won't be aware that the class name was changed in the meantime and it will remain working:
if ($(this).hasClass("bannerReady")) {
$("#banner").hover(
function() {
runOne();
},
function() {
runTwo();
}
);
}