I have a mouseover and mouseenter function that should only work if my variable is not set to true. But the mouse functions fire no matter what.
The If Statement checks to see if a variable is NOT TRUE but it doesn't seem to be working as I have it setup. The click function sets the variable to true, so when it is clicked, I should not be able to see the mouseover function working, until I set 'executed' back to false.
Any guidance is appreciated
var executed = false;
if (executed != true) {
$('.elm').mouseover(function(event) {
// do something only if variable is not set to true
})
};
if (executed != true) {
$('.elm').mouseout(function(event) {
// do something only if variable is not set to true
})
};
$('.elm').click(function() {
// do something and set variable to true
executed = true;
});
Aucun commentaire:
Enregistrer un commentaire