$("document").ready(function() {
$('#eventTarget').bind("mouseover", changeColor);//This doesnt work
$('#eventTarget').bind("mouseleave", changeColor);//This doesnt work
$('#eventTarget').bind("click", function(){ //This code works
$('#eventTarget').unbind("mouseover", changeColor);
$('#eventTarget').unbind("mouseleave", changeColor);
$('#eventTarget').html("<p> click event handler Canceled</p>");
});
});
function changeColor(evt) {
$('#eventTarget').toggleClass("highlight");
}
CSS:我的鼠標懸停,鼠標離開不起作用
.highlight
{
background-color:Red
}
.normal
{
background-color:Yellow
}
HTML體:
<div id="eventTarget" class="normal">
HardCoreProg...
* All activity
* Subscriptions
* Recommendations
</div>
哇..謝謝..它幫助了很多 –