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

jquery簡(jiǎn)單的彈出層浮動(dòng)層代碼

 更新時(shí)間:2015年04月27日 10:52:56   投稿:hebedich  
一個(gè)簡(jiǎn)單的jquery彈出框代碼實(shí)現(xiàn),點(diǎn)擊鏈接彈出模式對(duì)話框,任意點(diǎn)擊網(wǎng)頁(yè)的其它地方可以關(guān)閉彈出框,可以自定義透明度,簡(jiǎn)單實(shí)用的jquery彈出框效果。

jquery 智能彈出層,位置可以自適應(yīng),當(dāng)層靠右邊顯示時(shí)自動(dòng)往左移。初次運(yùn)行時(shí)請(qǐng)按F5刷新,載入遠(yuǎn)程jQuery后才能看到效果,點(diǎn)擊鼠標(biāo)左鍵,彈出層將出現(xiàn),在最右邊點(diǎn)擊時(shí)層自動(dòng)往左移。 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jquery彈出層浮動(dòng)層代碼</title>
<script src="/ajaxjs/jquery1.3.2.js" type="text/javascript"></script>
<style>
*{ margin:0; padding:0}
body{ margin:0; padding:0; font-size:12px}
ul,li{ list-style:none}
ul{position:relative;top:-3px; left:-3px;border:1px solid #ccc; background:#fff;}
li{height:23px;line-height:23px;cursor:default; padding:0 0 0 10px}
li.current{background:#eee}
.wrap{ width:158px; background:#eee; position:absolute;}
</style>
<script type="text/javascript">
$(function(){
$(".wrap").hide();
var objW=$(".wrap").width();
var objH=$(".wrap").height();
$(document).mousedown(function(e){
var selfX=objW+e.pageX;
var selfY=objH+e.pageY
var bodyW=document.documentElement.clientWidth+document.documentElement.scrollLeft;
var bodyH=document.documentElement.clientHeight+document.documentElement.scrollTop;
if(selfX>bodyW && selfY>bodyH){
$(".wrap").css({top:(bodyH-objH),left:(bodyW-objW)}).show();
}else if(selfY>bodyH){
$(".wrap").css({top:(bodyH-objH),left:e.pageX}).show();
}else if(selfX>bodyW){
$(".wrap").css({top:e.pageY,left:(bodyW-objW)}).show();
}else{
$(".wrap").css({top:e.pageY,left:e.pageX}).show();
}
})
$("li").hover(function(){
$(this).addClass("current");
},function(){
$(this).removeClass("current");
}).click(function(){
alert($(this).text())
$(this).parent().parent().hide();
})
})
</script>
</head>
<body>
<div style="height:800px;width:900px">&nbsp;</div>
<div style="position:absolute;top:300px;left:300px"><span style="color:#f00;font-size:28px">請(qǐng)按F5刷新,才能看到效果,</span><br>點(diǎn)擊鼠標(biāo)左鍵,彈出層,<br>在最右邊點(diǎn)擊時(shí)


層自動(dòng)往左移</div>
<div class="wrap">
<ul onmousedown="event.cancelBubble = true">
<li>連江</li>
<li>寧德</li>
<li>福州</li>
<li>廈門(mén)</li>
<li>北京</li>
</ul>
</div>
</body>
</html>

以上就是本文給大家分享的全部?jī)?nèi)容了,希望大家能夠喜歡。

相關(guān)文章

最新評(píng)論