Jquery鼠标进入和离开事件以切换到html页面中的div
代码如下
html代码
<div class="platform_solutions map_link" id="microsoft_link">
<h3>Heading One</h3>
</div>
<div class="testing map_link" id="opensource_link" >
<h3>Heading Two</h3>
</div>
<div class="branding_services map_link" id="verification_link">
<h3>Heading Three</h3>
</div>
<div class="corporate_profile map_link" id="branding_link">
<h3>Heading Four</h3>
</div>
<div id="microsoft_link1" style="display:none; padding-bottom:20px; float:left;" class="map_data">
<h4>Heading one</h4>
<p> Test data</p>
</div>
<div id="opensource_link1" style="display:none; padding-bottom:20px; float:left;" class="map_data">
<h4>Heading Two</h4>
<p> Test data two</p>
</div>
<div id="verification_link1" style="display:none; padding-bottom:20px; float:left;" class="map_data">
<h4>Heading Three</h4>
<p> Test data xussfsf</p>
</div>
<div id="branding_link1" style="display:none; padding-bottom:20px; float:left;" class="map_data">
<h4>Test Heading</h4>
<p> Test data sfs </p>
</div>
jQuery代码
$(document).ready(function(){
$(function() {
$('.map_link').mouseenter(function(){
event.preventDefault();
var currentId = $(this).attr('id');
$("#"+currentId+"1").slideToggle();
$("#"+currentId+"1").css('display','block');
}).mouseleave(function(){
event.preventDefault();
var currentId1 = $(this).attr('id');
$("#"+currentId1+"1").slideToggle();
});
});
});
代码工作正常。但是如果我们将鼠标从一个标题快速移动到另一个标题。它正在创造弹跳效果