日期:2014-05-16  浏览次数:20305 次

求助,类似csdn弹出层代码
就是鼠标移动到一个兄弟的id上就会弹出一个层,求这样的代码。谢谢

------解决方案--------------------
你可以在网上搜索,很多的。
------解决方案--------------------
查看>>源代码:)

直接研究CSDN的源码;)
------解决方案--------------------
HTML code

<div id="div1" style="background-color:blue;width:130px;" onmouseover="show();" onmouseout="hidden();">把鼠标移上来看看</div>
<div id="div2" style="position:absolute;z-index:10;background-color:red;width:200px;height:100;display:none;">DIV2</div>
<script>
function show(){
    var event=event||window.event;
    document.getElementById("div2").style.display="";
    document.getElementById("div2").style.left=event.clientX+"px";
    document.getElementById("div2").style.top=event.clientY+"px";
}
function hidden(){
    document.getElementById("div2").style.display="none";
}
</script>

------解决方案--------------------
注意几个事项:
1:它有时间延时处理;
2:延时处理的同时,前景色与背景色容在一起;
3:最终消失(隐藏)
------解决方案--------------------
收藏
------解决方案--------------------
mark ^_^
------解决方案--------------------
mark