mouseenter 事件,固定右侧客服特效


不论鼠标指针穿过被选元素或其子元素,都会触发 mouseover 事件。

只有在鼠标指针穿过被选元素时,才会触发 mouseenter 事件。

当鼠标指针离开元素时,会发生 mouseleave 事件。

<div class="kefu">
<div class="aaa" style="position: fixed; width: 40px; height: 200px; background: green; right: 0; top:500px; cursor: pointer; color:#fff;">右侧客服</div>
<div class="bbb" style="position: fixed; width: 200px; height: 200px; background:blue; right: 0; top:500px; display: none; cursor: pointer; color:#fff;">右侧客服内容区</div>
</div>

<script type="text/javascript">
$(document).ready(function(){
$(".kefu").mouseenter(function(){
$(this).find(".bbb").fadeIn(500);
});
$(".kefu").mouseleave(function(){
$(this).find(".bbb").fadeOut(500);
});
})
</script>
posted @ 2016-08-30 10:58  杜Amy  阅读(178)  评论(0编辑  收藏  举报