JS+CSS實(shí)現(xiàn)可拖拽的漂亮圓角特效彈出層完整實(shí)例
本文實(shí)例講述了JS+CSS實(shí)現(xiàn)可拖拽的漂亮圓角特效彈出層的方法。分享給大家供大家參考。具體如下:
<!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>JS+CSS實(shí)現(xiàn)的可拖拽的漂亮圓角效果的彈出層</title>
<style>
body{
margin:0px;
padding:0px;
font-size:14px;
}
#t {
position:absolute;
float:left;
left:0px;
top:0px;
}
#a {
float:left;
}
.al {
opacity: 0.80;
filter : progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=80,finishOpacity=100);
}
.al2{
opacity: 0.00;
filter : progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0,finishOpacity=100);
}
U {
DISPLAY: block;
OVERFLOW: hidden;
HEIGHT: 1px
}
U.f1 {
background-color:#5cc;
BACKGROUND: #5cc;
MARGIN: 0px 3px
}
U.f2 {
background-color:#5cc;
BORDER-RIGHT: #5cc 2px solid;
MARGIN: 0px 1px;
BORDER-LEFT: #5cc 2px solid
}
U.f3 {
background-color:#5cc;
BORDER-RIGHT: #5cc 1px solid;
MARGIN: 0px 1px;
BORDER-LEFT: #5cc 1px solid
}
.d_top{
clear:both;
overflow:hidden;
background-color:#5cc;
height:29px;
vertical-align:bottom;
}
.d_top a{
float:right;
margin-top:5px;
margin-right:13px;
padding-top:3px;
width:18px;
color:red;
background-color:#789;
text-decoration:none;
font-weight:bold;
text-align:center;
vertical-align:middle;
}
.d_top span{
float:left;
font-size:13px;
margin-left:15px;
margin-top:8px;
}
.d_body {
BORDER-RIGHT: #5cc 3px solid;
BORDER-LEFT: #5cc 3px solid;
padding:10px;
height:200px;
background-color:#fff;
}
.d_foot{
clear:both;
overflow:hidden;
background-color:#5cc;
height:2px;
}
</style>
<script type="text/javascript">
function $(id){return document.getElementById(id);}
function show(id){
var t = $(id);
t.style.width=document.body.clientWidth;
t.style.height=document.body.clientHeight;
window.onresize=function(){
t.style.width=document.body.clientWidth;
t.style.height=document.body.clientHeight;
}
$(id).style.display="";
}
function cl(id){
$(id).style.display="none";
}
function moveEvent(e,id){
var isIE = (document.all)?true:false;
drag = true;
xx=isIE?event.x:e.pageX;
yy=isIE?event.y:e.pageY;
L = document.getElementById(id).offsetLeft;
T = document.getElementById(id).offsetTop;
document.onmousemove = function(e) {
if (drag) {
x=isIE?event.x:e.pageX; if(x<0)x=0;
y=isIE?event.y:e.pageY; if(y<0)y=0;
document.getElementById(id).style.left = L-xx+x;
document.getElementById(id).style.top = T-yy+y;
}
}
document.onmouseup=function(){
drag = false;
}
}
window.onscroll=function(){
$("back_div").style.width=document.body.scrollWidth;
$("back_div").style.height=document.body.scrollHeight;
}
</script>
</head>
<body>
<div id="a" style="position:absolute; left:300px; top:200px;">
<a href="javascript:" onClick="show('t')">點(diǎn)這里彈出圓角效果的div</a><a href='http://www.dhdzp.com/' target='_blank'><u>對(duì)話框</u></a>! </div>
<div id="t" style="display:none;">
<div style="width:100%;height:100%; z-index:-1; position:absolute; float:left; background-color:#555;overflow:hidden;" class="al" id="back_div">
<iframe style="position:absolute; left:0px; top:0px; left:0px; bottom:0px; float:left; z-index:-1; margin:0px; padding:0px;" frameborder="0" scrolling="no" width="100%" height="2000px;" class="al2" id="ifr"></iframe>
</div>
<DIV style="WIDTH: 500px; position:absolute;float:left;top:25%; left:30%; z-index:999; clear:both; overflow:hidden;" id="t_div">
<iframe style="position:absolute; left:0px; top:0px; left:0px; bottom:0px; float:left; z-index:-1; margin:0px; padding:0px;" frameborder="0" scrolling="no" width="100%" height="2000px;" class="al2" id="ifr"></iframe>
<U class="f1"></U><U class="f2"></U><U class="f3"></U>
<div class="d_top" onMouseDown="moveEvent(event,'t_div')">
<span>歡迎光臨</span>
<a href="javascript:" onClick="cl('t')">×</a>
</div>
<DIV class="d_body" >歡迎光臨:腳本之家
</DIV>
<div class="d_foot"></div>
<U class="f3"></U><U class="f2"></U><U class="f1"></U>
</DIV>
</div>
</body>
</html>
希望本文所述對(duì)大家的javascript程序設(shè)計(jì)有所幫助。
相關(guān)文章
JavaScript常見數(shù)組方法之如何轉(zhuǎn)置矩陣
這篇文章主要給大家介紹了關(guān)于JavaScript常見數(shù)組方法之如何轉(zhuǎn)置矩陣的相關(guān)資料,文中通過實(shí)例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2022-03-03
JS實(shí)現(xiàn)自動(dòng)輪播圖效果(自適應(yīng)屏幕寬度+手機(jī)觸屏滑動(dòng))
這篇文章主要介紹了JS實(shí)現(xiàn)自動(dòng)輪播圖效果(自適應(yīng)屏幕寬度+手機(jī)觸屏滑動(dòng)),需要的朋友可以參考下2017-06-06
javascript瀏覽器用戶代理檢測(cè)腳本實(shí)現(xiàn)方法
下面小編就為大家?guī)硪黄猨avascript瀏覽器用戶代理檢測(cè)腳本實(shí)現(xiàn)方法。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-10-10
實(shí)現(xiàn)web打印的各種方法介紹及實(shí)現(xiàn)代碼
web的打印方法具我自己懂得知道的有:JQuery插件Jqprint實(shí)現(xiàn);JQery打印插件PrintArea實(shí)現(xiàn)網(wǎng)頁打印;CSS控制網(wǎng)頁打印樣式,本文詳細(xì)介紹實(shí)現(xiàn)步驟,感興趣的朋友可以了解下2013-01-01
JS實(shí)現(xiàn)的簡(jiǎn)單鼠標(biāo)跟隨DiV層效果完整實(shí)例
這篇文章主要介紹了JS實(shí)現(xiàn)的簡(jiǎn)單鼠標(biāo)跟隨DiV層效果,涉及JavaScript基于時(shí)間函數(shù)動(dòng)態(tài)操作頁面元素屬性的相關(guān)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-10-10
利用js動(dòng)態(tài)添加刪除table行的示例代碼
本篇文章主要是對(duì)利用js動(dòng)態(tài)添加刪除table行的示例代碼進(jìn)行了介紹,需要的朋友可以過來參考下,希望對(duì)大家有所幫助2013-12-12
擴(kuò)展javascript的Date方法實(shí)現(xiàn)代碼(prototype)
長期從事C#的開發(fā),被C#影響著我的思維。C#中DateTime的操作就很方便,于是就參考它對(duì)js的Date做了擴(kuò)展。2010-11-11
解決echarts的多個(gè)折現(xiàn)數(shù)據(jù)出現(xiàn)坐標(biāo)和值對(duì)不上的問題
這篇文章主要介紹了解決echarts的多個(gè)折現(xiàn)數(shù)據(jù)出現(xiàn)坐標(biāo)和值對(duì)不上的問題,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2018-12-12

