欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

基于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.dbjr.com.cn" />
<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)單易懂,寫(xiě)的不好還請(qǐng)各位大俠見(jiàn)諒,希望本文分享能夠給大家?guī)?lái)幫助。

相關(guān)文章

  • jquery實(shí)現(xiàn)圖片漸變切換兼容ie6/Chrome/Firefox

    jquery實(shí)現(xiàn)圖片漸變切換兼容ie6/Chrome/Firefox

    jquery代碼實(shí)現(xiàn)圖片漸變切換同時(shí)兼容ie6、Chrome、Firefox,想學(xué)習(xí)的朋友可以測(cè)試下,希望對(duì)大家有所幫助
    2013-08-08
  • 詳談jQuery Ajax(load,post,get,ajax)的用法

    詳談jQuery Ajax(load,post,get,ajax)的用法

    下面小編就為大家?guī)?lái)一篇詳談jQuery Ajax(load,post,get,ajax)的用法。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2017-03-03
  • (function($){...})(jQuery)的意思

    (function($){...})(jQuery)的意思

    (function($){...})(jQuery)實(shí)際上是匿名函數(shù),不懂得朋友可以繼續(xù)往下看。
    2010-07-07
  • jquery判斷瀏覽器類(lèi)型的代碼

    jquery判斷瀏覽器類(lèi)型的代碼

    用jquery來(lái)判斷瀏覽器類(lèi)型,如果只是僅僅為了判斷瀏覽器的類(lèi)型而使用該方法,那么不建議使用,只是在你已經(jīng)使用了jquery才建議使用,因?yàn)闆](méi)必要因?yàn)檫@么小的一個(gè)功能就加載那么大的類(lèi)庫(kù)吧
    2012-11-11
  • 最新評(píng)論