最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

基于jQuery實(shí)現(xiàn)點(diǎn)擊彈出層實(shí)例代碼

 更新時(shí)間:2016年01月01日 10:26:51   作者:gogoggo  
基于jquery實(shí)現(xiàn)點(diǎn)擊鏈接彈出層效果,其基本實(shí)現(xiàn)原理是這樣的:jquery操作DOM元素。對(duì)層樣式的設(shè)置。將display:設(shè)置為none;讓層隱藏;對(duì)jq點(diǎn)擊彈出層相關(guān)知識(shí)感興趣的朋友一起學(xué)習(xí)吧

jquery實(shí)現(xiàn)點(diǎn)擊鏈接彈出層效果:本例實(shí)現(xiàn)的主要原理:jquery操作DOM元素。對(duì)層樣式的設(shè)置。將display:設(shè)置為none;讓層隱藏;

代碼實(shí)例如下:

<!DOCTYPE html>
<html>
<head>
<meta charset=" utf-8">
<meta name="author" content="http://www.fzitv.net" />
<title>子選擇器</title>
<style type="text/css">
#choice_list_district{
height:50px;
}
#tab td{
cursor:pointer;
}
#divobj{
position:absolute; 
width:200px; 
height:200px; 
background:blue; 
border:1px solid block; 
display:none; 
z-index:9999;
}
</style>
<script type="text/javascript" src="mytest/jQuery/jquery-1.8.3.js"></script> 
<script type="text/javascript"> 
$(function (){ 
$("#choice_list_district a").click(function(e){ 
if($("#divobj").css("display")=="none"){ 
e.stopPropagation(); 
var offset=$(e.target).offset(); 
$("#divobj").css({top:offset.top+$(e.target).height()+"px",left:offset.left}); 
$("#divobj").show(); 
} 
else{ 
$("#divobj").hide(); 
} 
}); 
$(document).click(function(event){ 
$("#divobj").hide(); 
}); 
}); 
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<div id="choice_list_district"> <a href="#">出來(lái)層</a> </div>
<div id="divobj"></div>
</div>
</form>
</body>
</html>

以上代碼中,點(diǎn)擊鏈接可以彈出隱藏的層,再點(diǎn)擊任何地方就可以隱藏此層。

本段代碼簡(jiǎn)單易懂,寫的不好還請(qǐng)各位大俠見(jiàn)諒,希望本文分享能夠給大家?guī)?lái)幫助。

相關(guān)文章

最新評(píng)論

民丰县| 东乡县| 泸定县| 凤庆县| 西林县| 遂溪县| 神池县| 钟山县| 额济纳旗| 酉阳| 保山市| 竹溪县| 会泽县| 于田县| 吉林市| 乐昌市| 体育| 广平县| 上犹县| 麻江县| 珲春市| 永平县| 磐石市| 石台县| 湘乡市| 扬中市| 五大连池市| 治多县| 疏勒县| 阿巴嘎旗| 盈江县| 神农架林区| 盖州市| 习水县| 布拖县| 庐江县| 札达县| 双桥区| 余庆县| 潞西市| 巴彦淖尔市|