У меня есть следующий код JQuery:Jquery MouseLeave SetTimeout не работает
$(".name")
.on("mouseenter", function() {
$(this).find("ul").css({"font-size": "20px",
'color': "red"});
})
.on("mouseleave", function() {
setTimeout(function() {
$(this).find("ul").css({"font-size": "12px",
'color': "blue"});
}, 5000);
});
Первая часть работает, но вторая часть нарушается.
Почему setTimeout
не работает mouseleave
?
'this' решает как не то, что нужно. – vlaz