jQuery彈出層插件popShow(改進(jìn)版)用法示例
本文實(shí)例講述了jQuery彈出層插件popShow(改進(jìn)版)用法。分享給大家供大家參考,具體如下:
前面一篇《jQuery彈出層插件popShow用法示例》分析了popShow插件的基本用法,這里再對(duì)插件進(jìn)行一番改進(jìn)。
popShow彈出層

圖1.1 彈出層效果
1、引入JS和CSS文件
<link href="popShow.css" rel="stylesheet" type="text/css" /> <script src="/js/common/jquery.min.js" type="text/javascript"></script> <script src="popShow.js" type="text/javascript"></script>
注意:這里需要引入jQuery庫文件。
2、編寫HTML代碼
<div id="swinLogin" style="width:230px; display:none;">
<table>
<tr>
<th>用戶名</th>
<td><input id="txtUserName" type="text" /></td>
</tr>
<tr>
<th>密碼</th>
<td><input id="txtPsw" type="password" /></td>
</tr>
<tr>
<th></th>
<td><input type="button" value="登錄" /></td>
</tr>
</table>
</div>
3、popShow的使用
(1) 打開彈出層
$("#swinLogin").popShow("用戶登錄");
(2) 關(guān)閉彈出層
$("#swinLogin").popHide();
附件
附件1:popShow.js
$.fn.popShow = function(title) {
var tag = this;
$('<div class=\"g-mask\"><iframe frameborder=\"0\" scrolling=\"no\"></iframe></div>').appendTo('body');
this.show().attr('par', this.parent().length ? true : false).appendTo('body').wrapAll('<table class=\"g-popup\"><tr><td></td></tr></table>');
this.wrapAll('<div class=\"g-popup-wrap\" style=\"width:' + this.outerWidth(true) + 'px\"></div>').before('<div class=\"g-popup-title g-line-dashed\">' + (title ? title : '') + '</div>').before($('<a class=\"g-popup-hide\" href=\"javascript:;\"></a>').click(function() {
tag.popHide()
}));
return this
};
$.fn.popHide = function() {
var tab = this.closest('table');
this.attr('par') == 'true' ? this.hide().appendTo('body') : this.remove();
tab.prev().remove();
tab.remove();
return this
};
附件2:popShow.css
/*彈出層*/
.g-mask, .g-mask iframe, .g-popup { width:100%; height:100%; }
.g-mask { background:#fff; filter:alpha(opacity=80); opacity:0.8; }
.g-mask iframe { filter:alpha(opacity=0); opacity:0; }
.g-mask, .g-popup { position:fixed; top:0; left:0; z-index:10000; _position:absolute; _top:expression(documentElement.scrollTop + "px");}
.g-black-mask {background:#000;opacity:0.7;}
.g-black-popup{position:absolute;}
.g-popup { text-align:center; }
.g-popup-wrap { padding:30px; background:#fff; border:#E95A59 solid 4px; text-align:left; position:relative; margin:0 auto; }
.g-popup-title { font-size:14px; height:28px; line-height:28px; overflow:hidden; margin-bottom:20px; font-weight:bold; color:#e25150; border-bottom:1px dotted #AAAAAA}
.g-popup-hide {background:url("/images/popBtn.png") 0 0 no-repeat; width:34px; height:30px; display:block; position:absolute; right:5px; top:5px; z-index:99; }
.g-popup-hide:hover { background-position:0 -40px; }
.g-info-hide { width:34px; height:30px; display:block; position:absolute; background-position:0 -1320px; top:5px; right:5px; }
.g-info-hide:hover { background-position:0 -1360px; }
.g-popup-tip { height: 0; overflow: hidden; position: fixed; z-index:10001; bottom: 0; right: 0; _position: absolute; _bottom: auto; _top: expression(eval(document.documentElement.scrollTop + document.documentElement.clientHeight - this.offsetHeight - (parseInt(this.currentStyle.marginTop, 10) || 0) - (parseInt(this.currentStyle.marginBottom, 10) || 0)));}
附件3:關(guān)閉按鈕圖標(biāo)(popBtn.png)

更多關(guān)于jQuery相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《jQuery常用插件及用法總結(jié)》、《jquery中Ajax用法總結(jié)》、《jQuery表格(table)操作技巧匯總》、《jQuery拖拽特效與技巧總結(jié)》、《jQuery擴(kuò)展技巧總結(jié)》、《jQuery常見經(jīng)典特效匯總》、《jQuery動(dòng)畫與特效用法總結(jié)》及《jquery選擇器用法總結(jié)》
希望本文所述對(duì)大家jQuery程序設(shè)計(jì)有所幫助。
- jQuery彈出層插件popShow用法示例
- jQuery Dialog 彈出層對(duì)話框插件
- JQUERY THICKBOX彈出層插件
- jQuery彈出層插件簡(jiǎn)化版代碼下載
- Jquery 彈出層插件實(shí)現(xiàn)代碼
- 基于jquery的blockui插件顯示彈出層
- jquery.artwl.thickbox.js 一個(gè)非常簡(jiǎn)單好用的jQuery彈出層插件
- jQuery插件zoom實(shí)現(xiàn)圖片全屏放大彈出層特效
- 一個(gè)jquery的彈出層的插件
- jQuery boxy彈出層插件中文演示及使用講解
- js彈出層(jQuery插件形式附帶reLoad功能)
- Jquery實(shí)現(xiàn)彈出層分享微博插件具備動(dòng)畫效果
- jQuery彈出層插件Lightbox_me使用指南
- Jquery彈出層插件ThickBox的使用方法
相關(guān)文章
JQuery 插件制作實(shí)踐 xMarquee插件V1.0
今天要介紹的是實(shí)現(xiàn)類跑馬燈效果的的廣告插件。類似偶公司web-dev的同事在網(wǎng)站首頁上做的目錄廣告播放器。其實(shí)很簡(jiǎn)單,LEVIN實(shí)際應(yīng)用中也用到,所以稍作整理如下.2010-04-04
jQuery實(shí)現(xiàn)驗(yàn)證年齡簡(jiǎn)單思路
本文給大家分享的是jQuery實(shí)現(xiàn)驗(yàn)證年齡簡(jiǎn)單思路,讓用戶填出生年月,然后根據(jù)當(dāng)前時(shí)間計(jì)算是否小于網(wǎng)站要求的年齡,小于就提示,有需要的小伙伴可以拿去直接使用。2016-02-02
jQuery簡(jiǎn)介_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理
目前jQuery有1.x和2.x兩個(gè)主要版本,區(qū)別在于2.x移除了對(duì)古老的IE 6、7、8的支持,因此2.x的代碼更精簡(jiǎn)。選擇哪個(gè)版本主要取決于你是否想支持IE 6~8,下文給大分享jquery 簡(jiǎn)介的相關(guān)知識(shí),感興趣的朋友一起看看吧2017-07-07
Jquery AJAX POST與GET之間的區(qū)別詳細(xì)介紹
這篇文章主要介紹了Jquery AJAX POST與GET之間的區(qū)別詳細(xì)介紹的相關(guān)資料,需要的朋友可以參考下2016-10-10
hovertree插件實(shí)現(xiàn)二級(jí)樹形菜單(簡(jiǎn)單實(shí)用)
hovertree是一個(gè)仿京東的樹形菜單jquery插件,暫時(shí)有銀色和綠色兩種。本文將對(duì)此進(jìn)行介紹。具有一定的參考價(jià)值,下面跟著小編一起來看下吧2016-12-12
JQuery給select添加/刪除節(jié)點(diǎn)的實(shí)現(xiàn)代碼
下面小編就為大家?guī)硪黄狫Query給select添加/刪除節(jié)點(diǎn)的實(shí)現(xiàn)代碼。小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考2016-04-04
jquery實(shí)現(xiàn)的代替?zhèn)鹘y(tǒng)checkbox樣式插件
這篇文章主要介紹了jquery實(shí)現(xiàn)的代替?zhèn)鹘y(tǒng)checkbox樣式插件,可實(shí)現(xiàn)滑動(dòng)選擇的效果,需要的朋友可以參考下2015-06-06

