亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

jQuery彈出層插件popShow(改進(jìn)版)用法示例

 更新時間:2017年01月23日 11:21:20   作者:pan_junbiao  
這篇文章主要介紹了jQuery彈出層插件popShow(改進(jìn)版)用法,對比前文分析了popShow插件的使用方法,需要的朋友可以參考下

本文實例講述了jQuery彈出層插件popShow(改進(jìn)版)用法。分享給大家供大家參考,具體如下:

前面一篇《jQuery彈出層插件popShow用法示例》分析了popShow插件的基本用法,這里再對插件進(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動畫與特效用法總結(jié)》及《jquery選擇器用法總結(jié)

希望本文所述對大家jQuery程序設(shè)計有所幫助。

相關(guān)文章

  • Jquery中$.get(),$.post(),$.ajax(),$.getJSON()的用法總結(jié)

    Jquery中$.get(),$.post(),$.ajax(),$.getJSON()的用法總結(jié)

    本文是對Jquery中$.get(),$.post(),$.ajax(),$.getJSON()的用進(jìn)行了詳細(xì)的總結(jié)介紹,需要的朋友可以過來參考下,希望對大家有所幫助
    2013-11-11
  • jquery實現(xiàn)彈出層完美居中效果

    jquery實現(xiàn)彈出層完美居中效果

    本篇文章主要是對jquery彈出層居中效果的簡單實例進(jìn)行了介紹,需要的朋友可以過來參考下,希望對大家有所幫助
    2014-03-03
  • jQuery中可見性過濾器簡單用法示例

    jQuery中可見性過濾器簡單用法示例

    這篇文章主要介紹了jQuery中可見性過濾器簡單用法,結(jié)合實例形式簡單分析了jQuery中可見性過濾器的原理及相關(guān)使用技巧,需要的朋友可以參考下
    2018-03-03
  • jQuery DOM刪除節(jié)點操作指南

    jQuery DOM刪除節(jié)點操作指南

    本章節(jié)主要介紹了jQuery中dom操作的三種刪除節(jié)點的方法,即remove(),detach()和empty(),并附上示例代碼,非常實用,這里推薦給小伙伴們。
    2015-03-03
  • jQuery實現(xiàn)form表單元素序列化為json對象的方法

    jQuery實現(xiàn)form表單元素序列化為json對象的方法

    這篇文章主要介紹了jQuery實現(xiàn)form表單元素序列化為json對象的方法,涉及jQuery基于serializeArray方法實現(xiàn)表單序列化的相關(guān)技巧,需要的朋友可以參考下
    2015-12-12
  • jQuery.form插件的使用及跨域異步上傳文件

    jQuery.form插件的使用及跨域異步上傳文件

    這個跨域異步上傳功能我們借助了Jquery.form插件。接下來通過本文給大家介紹jQuery跨域異步上傳文件的相關(guān)知識,感興趣的朋友一起學(xué)習(xí)吧
    2016-04-04
  • JQuery跨Iframe選擇實現(xiàn)代碼

    JQuery跨Iframe選擇實現(xiàn)代碼

    JQuery跨Iframe選擇實現(xiàn),下面也通過用DOM方法與jquery方法結(jié)合的方式實現(xiàn)了,需要的朋友可以參考下。
    2010-08-08
  • 淺析jquery與checkbox的checked屬性的問題

    淺析jquery與checkbox的checked屬性的問題

    下面小編就為大家?guī)硪黄獪\析jquery與checkbox的checked屬性的問題。小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考,一起跟隨小編過來看看吧
    2016-04-04
  • jQuery中trigger()與bind()用法分析

    jQuery中trigger()與bind()用法分析

    這篇文章主要介紹了jQuery中trigger()與bind()用法,結(jié)合實例形式分析了trigger()與bind()的功能、定義及具體使用技巧,需要的朋友可以參考下
    2015-12-12
  • Jquery操作cookie記住用戶名

    Jquery操作cookie記住用戶名

    jquery.cookie.js是一個基于jquery的插件,一個輕量級的cookie 插件,可以讀取、寫入、刪除 cookie。接下來通過本文給大家介紹Jquery操作cookie記住用戶名,需要的朋友參考下吧
    2016-03-03

最新評論