JQuery制作的放大效果的popup對(duì)話框(未添加任何jquery plugin)分享
更新時(shí)間:2013年04月28日 16:33:09 作者:
分享一個(gè)JQuery制作的放大效果的popup對(duì)話框(未添加任何jquery plugin)項(xiàng)目中可以根據(jù)自己的需求來寫css,感興趣的朋友可以了解下哈
多的不說了,直奔主題,分享一個(gè)放大效果的popup dialog,項(xiàng)目中可以根據(jù)自己的需求來寫css,我打算復(fù)用到metro風(fēng)格的site上去。
看起來動(dòng)畫效果還是比較cool的,如果加上了處理后的效果更佳:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<style>
body { background: #ace; font: 12px/1.2 Arial, Helvetica, sans-serif; }
ul li { background:#fff; margin:5px; width:100px; height:100px; float:left; }
#transition {
background:transparent;
display:none;
position:absolute; top:50%; left:50%; z-index:50;
z-index: 10001;
}
#content {
background:#fff;
border:1px solid #666;
margin:-50px 0 0 -50px;
width:100px; height:100px;
z-index: 10001;
}
#mask{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #000000;
display: none;
z-index: 10000;
}
.close
{
width:30px;
height:20px;
background-color:Red;
cursor:pointer;
display:none;
}
.closeShow
{
width:30px;
height:20px;
margin-left:50px;
margin-top:-100px;
background-color:Red;
cursor:pointer;
}
</style>
<script type="text/javascript">
$(document).ready(function () {
$('ul li').click(function (e) {
$("#mask").fadeTo(500, 0.25);
$("#content").html("<div>Loading....</div>");
var $t = $('#transition'),
to = $(this).offset();
var height = $(document).height();
var width = $(document).width();
$('#content').css({ width: 100, height: 100 });
$t.css({
top: to.top + 50,
left: to.left + 50,
display: 'block'
}).animate({
top: height / 2,
left: width / 2
}, 600, function () {
$(this).animate({
top: 125,
left: 175
}, 600);
$('#content').animate({
width: width * 0.8,
height: height * 0.8
}, 600, function () {
// open dialog here
$("#content").html("<div>Hello, please put content here.</div>");
});
});
});
$('#transition').click(function (e) {
$("#transition").hide();
$("#mask").hide();
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<ul>
<li>thumb</li>
<li>thumb</li>
<li>thumb</li>
<li>thumb</li>
<li>thumb</li>
<li>thumb</li>
<li>thumb</li>
<li>thumb</li>
<li>thumb</li>
</ul>
<div id='mask'></div>
<div id="transition"><div id="content">Loading....</div></div>
</form>
</body>
</html>
加入了mask效果,如果不需要可以直接刪掉。
看起來動(dòng)畫效果還是比較cool的,如果加上了處理后的效果更佳:
復(fù)制代碼 代碼如下:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<style>
body { background: #ace; font: 12px/1.2 Arial, Helvetica, sans-serif; }
ul li { background:#fff; margin:5px; width:100px; height:100px; float:left; }
#transition {
background:transparent;
display:none;
position:absolute; top:50%; left:50%; z-index:50;
z-index: 10001;
}
#content {
background:#fff;
border:1px solid #666;
margin:-50px 0 0 -50px;
width:100px; height:100px;
z-index: 10001;
}
#mask{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #000000;
display: none;
z-index: 10000;
}
.close
{
width:30px;
height:20px;
background-color:Red;
cursor:pointer;
display:none;
}
.closeShow
{
width:30px;
height:20px;
margin-left:50px;
margin-top:-100px;
background-color:Red;
cursor:pointer;
}
</style>
<script type="text/javascript">
$(document).ready(function () {
$('ul li').click(function (e) {
$("#mask").fadeTo(500, 0.25);
$("#content").html("<div>Loading....</div>");
var $t = $('#transition'),
to = $(this).offset();
var height = $(document).height();
var width = $(document).width();
$('#content').css({ width: 100, height: 100 });
$t.css({
top: to.top + 50,
left: to.left + 50,
display: 'block'
}).animate({
top: height / 2,
left: width / 2
}, 600, function () {
$(this).animate({
top: 125,
left: 175
}, 600);
$('#content').animate({
width: width * 0.8,
height: height * 0.8
}, 600, function () {
// open dialog here
$("#content").html("<div>Hello, please put content here.</div>");
});
});
});
$('#transition').click(function (e) {
$("#transition").hide();
$("#mask").hide();
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<ul>
<li>thumb</li>
<li>thumb</li>
<li>thumb</li>
<li>thumb</li>
<li>thumb</li>
<li>thumb</li>
<li>thumb</li>
<li>thumb</li>
<li>thumb</li>
</ul>
<div id='mask'></div>
<div id="transition"><div id="content">Loading....</div></div>
</form>
</body>
</html>
加入了mask效果,如果不需要可以直接刪掉。
您可能感興趣的文章:
- mysql自動(dòng)停止 Plugin FEDERATED is disabled 的完美解決方法
- jQuery多媒體插件jQuery Media Plugin使用詳解
- Ext4.2的Ext.grid.plugin.RowExpander無法觸發(fā)事件解決辦法
- jQuery中關(guān)于ScrollableGridPlugin.js(固定表頭)插件的使用逐步解析
- MySql報(bào)錯(cuò)Table mysql.plugin doesn’t exist的解決方法
- DIY jquery plugin - tabs標(biāo)簽切換實(shí)現(xiàn)代碼
- 制作高質(zhì)量的JQuery Plugin 插件的方法
- LazyForm jQuery plugin 定制您的CheckBox Radio和Select
- 一步一步教你寫一個(gè)jQuery的插件教程(Plugin)
- Maven的幾個(gè)常用plugin
相關(guān)文章
Jquery圖形報(bào)表插件 jqplot簡(jiǎn)介及參數(shù)詳解
jqPlot是 一款基于jquery類庫的圖標(biāo)繪制插件。通過jqPlot可以再網(wǎng)頁中繪制線狀、柱狀、餅狀等多種樣式圖表。而且,jqPlot具有插件可擴(kuò)展性 (Pluggability),你可以編寫自己的圖表樣式2012-10-10判斷多個(gè)input type=file是否有已經(jīng)選擇好文件的代碼
在each中使用return false退出循環(huán),使用return true結(jié)束當(dāng)前次循環(huán),進(jìn)行下一次循環(huán)2012-05-05jquery如何根據(jù)值設(shè)置默認(rèn)的選中項(xiàng)
這篇文章主要介紹了jquery如何根據(jù)值設(shè)置默認(rèn)的選中項(xiàng),需要的朋友可以參考下2014-03-03完美兼容各大瀏覽器的jQuery仿新浪圖文淡入淡出間歇滾動(dòng)特效
本文是作者學(xué)習(xí)jQuery之后練手之作,兼容各大瀏覽器,非常的精美實(shí)用,這里放出來給小伙伴們,有需要的直接拿走,別跟我客氣^_^2014-11-11jQuery插件HighCharts繪制2D半圓環(huán)圖效果示例【附demo源碼下載】
這篇文章主要介紹了jQuery插件HighCharts繪制2D半圓環(huán)圖效果,結(jié)合實(shí)例形式分析了jQuery使用HighCharts插件繪制半圓環(huán)圖形的相關(guān)操作技巧,并附帶demo源碼供讀者下載參考,需要的朋友可以參考下2017-03-03jquery 設(shè)置元素相對(duì)于另一個(gè)元素的top值(實(shí)例代碼)
在jquery中offset().top是相對(duì)于body來說的,另外在設(shè)置top值的時(shí)候要找到與該元素最近的有相對(duì)值的元素2013-11-11jQuery判斷div隨滾動(dòng)條滾動(dòng)到一定位置后停止
這篇文章主要介紹了jQuery判斷div隨滾動(dòng)條滾動(dòng)到一定位置后停止的方法,需要的朋友可以參考下2014-04-04