Jquery怎样绑定,就是鼠标放上去背景色变,移除背景色变。最后要解除绑定。
2条回答 默认 最新
斯洛文尼亚旅游 2015-12-28 06:01关注<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.1.min.js"></script> <a href="#" id="a">鼠标放上来</a> <script> $('#a').mouseenter(function () { $(this).css('background-color', '#f00') }).mouseleave(function () { $(this).css('background-color', '') }); setTimeout(function () { alert('unbind'); $('#a').unbind('mouseenter').unbind('mouseleave') }, 5000)//5秒后移除hover事件 </script>解决 无用评论 打赏 举报