Answer the question
In order to leave comments, you need to log in
jquery to jquery coffeescript hover handling?
I do a background change when the cursor is not on the element, in pure jquery it looks like this:
$("li").hover(<br>
// При наведении курсора<br>
function () {<br>
$("i",this).css("background-image", "url(assets/blue-icon.png)");<br>
},<br>
// При убирании курсора<br>
function () {<br>
$("i",this).css("background-image", "url(assets/white-icon.png)");<br>
}<br>
);<br>
$("li").hover -><br>
$("i",this).css("background-image", "url(assets/blue-icon.png)")<br>
Answer the question
In order to leave comments, you need to log in
$("li").hover (
-> $("i", @).css "background-image", "url(assets/blue-icon.png)"
-> $("i", @). css "background-image", "url(assets/white-icon.png)"
)
and js2coffee.org/
In jQuery it's better like this:
$(document).ready(function(){
$("li").mouseenter(function(){
$( i,this).css({"background-image": "url(assets/blue-icon.png)"});
}).mouseleave(function(){
$( i,this).css({"background-image": "url(assets/white-icon.png)"});
});
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question