<button id="show_tiggle">移入显示内容,移出隐藏内容</button >
<div id="tiggle" style="display:none;">默认隐藏,移入显示的div</div>
<script>
(function(){
//获取到按钮和对应显示隐藏的标签
var btn = document.getElementById('show_tiggle');
var box = document.getElementById('tiggle');
//初始化时间
var timer = null;
//鼠标移入按钮时候显示标签
box.onmouseover = btn.onmouseover = function(){
if(timer) clearTimeout(timer)
box.style.display = 'block';
}
//移出后半秒标签内容自动消失
box.onmouseout = btn.onmouseout = function(){
timer = setTimeout(function(){
box.style.display = 'none';
},500);
}
})();
</script>