<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      分享一個(gè)灰常簡(jiǎn)單好用的jQuery彈出層插件:jquery.artwl.thickbox.js

      最終效果:

      插件原理

        所有彈出層的原理都差不多,就是用一個(gè)全屏半透明DIV做遮罩層,在這個(gè)遮罩層上再顯示出一個(gè)層放要顯示的內(nèi)容,其他的就是CSS的運(yùn)用了。

        本插件為了使用簡(jiǎn)單,把JS跟CSS封裝在了一個(gè)JS文件(插件)中,所以使用起來(lái)非常方便,做到了一行代碼調(diào)用。

      插件源代碼

        插件(jquery.artwl.thickbox.js)的源碼如下:

      /* File Created: 三月 1, 2012     Author:artwl  blog:http://artwl.cnblogs.com */
      ;(function ($) {
      $.extend({
      artwl_bind: function (options) {
      options=$.extend({
      showbtnid:"",
      title:"",
      content:""
      },options);
      var mask = '<div id="artwl_mask"></div>';
      var boxcontain = '<div id="artwl_boxcontain">\
      <a id="artwl_close" href="javascript:void(0);" title="Close"></a>\
      <div id="artwl_showbox">\
      <div id="artwl_title">\
      <h2>\
      Title</h2>\
      </div>\
      <div id="artwl_message">\
      Content<br />\
      </div>\
      </div>\
      </div>';
      var cssCode = 'html, body, h1, h2, h3, h4, h5{margin: 0px;padding: 0px;}\
      #artwl_mask{background-color: #000;position: absolute;top: 0px;left: 0px;width: 100%;height: 100%;opacity: 0.5;filter: alpha(opacity=50);display: none;}\
      #artwl_boxcontain{margin: 0 auto;position: absolute;z-index: 2;line-height: 28px;display: none;}\
      #artwl_showbox{padding: 10px;background: #FFF;border-radius: 5px;margin: 20px;min-width:300px;min-height:200px;}\
      #artwl_title{position: relative;height: 27px;border-bottom: 1px solid #999;}\
      #artwl_close{position: absolute;cursor: pointer;outline: none;top: 0;right: 0;z-index: 4;width: 42px;height: 42px;overflow: hidden;background-image: url(/Images/feedback-close.png);_background: none;}\
      #artwl_message{padding: 10px 0px;overflow: hidden;line-height: 19px;}';
      if ($("#artwl_mask").length == 0) {
      $("body").append(mask + boxcontain);
      $("head").append("<style type='text/css'>" + cssCode + "</style>");
      if(options.title!=""){
      $("#artwl_title").html(options.title);
      }
      if(options.content!=""){
      $("#artwl_message").html(options.content);
      }
      }
      $("#"+options.showbtnid).click(function () {
      var height = $("#artwl_boxcontain").height();
      var width = $("#artwl_boxcontain").width();
      $("#artwl_mask").show();
      $("#artwl_boxcontain").css("top", ($(window).height() - height) / 2).css("left", ($(window).width() - width) / 2).show();
      if ($.browser.msie && $.browser.version.substr(0, 1) < 7) {
      width = $(window).width() > 600 ? 600 : $(window).width() - 40;
      $("#artwl_boxcontain").css("width", width + "px").css("top", ($(window).height() - height) / 2).css("left", ($(window).width() - width) / 2).show();
      $("#artwl_mask").css("width", $(window).width() + "px").css("height", $(window).height() + "px").css("background", "#888");
      $("#artwl_close").css("top", "30px").css("right", "30px").css("font-size", "20px").text("關(guān)閉");
      }
      });
      $("#artwl_close").click(function () {
      $("#artwl_mask").hide();
      $("#artwl_boxcontain").hide();
      });
      },
      artwl_close:function(options){
      options=$.extend({
      callback:null
      },options);
      $("#artwl_mask").hide();
      $("#artwl_boxcontain").hide();
      if(options.callback!=null){
      options.callback();
      }
      }
      });
      })(jQuery);

        調(diào)用也非常簡(jiǎn)單,在頁(yè)面引入此JS文件后,在頁(yè)面加載方法中調(diào)用如下代碼即可:

      $.artwl_bind({ showbtnid: "btn_show", title: "From Cnblogs Artwl", content: $("#Content").html() });

        這三個(gè)參數(shù)非常簡(jiǎn)單,第一個(gè)是彈出層觸發(fā)事件的元素ID,第二個(gè)為彈出層的標(biāo)題,第三個(gè)為彈出層的內(nèi)容

      注意事項(xiàng)

        為了使用方便,本插件把JS跟CSS寫在了一個(gè)文件中,如果要調(diào)整彈出層的樣式可以修改如下CSS即可。

        插件CSS代碼:

      html, body, h1, h2, h3, h4, h5 {
      margin
      : 0px;
      padding
      : 0px;
      }
      #artwl_mask
      {
      background - color
      : #000;
      position
      : absolute;
      top
      : 0px;
      left
      : 0px;
      width
      : 100%;
      height
      : 100%;
      opacity
      : 0.5;
      filter
      : alpha(opacity= 50);
      display
      : none;
      }
      #artwl_boxcontain
      {
      margin
      : 0 auto;
      position
      : absolute;
      z - index
      : 2;
      line - height
      : 28px;
      display
      : none;
      }
      #artwl_showbox
      {
      padding
      : 10px;
      background
      : #FFF;
      border - radius
      : 5px;
      margin
      : 20px;
      min - width
      : 300px;
      min - height
      : 200px;
      }
      #artwl_title
      {
      position
      : relative;
      height
      : 27px;
      border - bottom
      : 1px solid #999;
      }
      # artwl_close
      {
      position
      : absolute;
      cursor
      : pointer;
      outline
      : none;
      top
      : 0;
      right
      : 0;
      z - index
      : 4;
      width
      : 42px;
      height
      : 42px;
      overflow
      : hidden;
      background - image
      : url(/Images/feedback - close.png);
      _background
      : none;
      }
      #artwl_message
      {
      padding
      : 10px 0px;
      overflow
      : hidden;
      line - height
      : 19px;
      }

        另外,針對(duì)IE6不支持透明作了特殊處理,在IE6下顯示為:

      IE6

      其他瀏覽器

        Demo下載地址:https://files.cnblogs.com/artwl/Demo.zip

      插件更新

        園友“技術(shù)宅男”發(fā)現(xiàn)了有滾動(dòng)條時(shí)的bug,之前沒(méi)考慮周全,修改后插件代碼如下:

      ; (function ($) {
      $.extend({
      artwl_bind: function (options) {
      options = $.extend({
      title: "",
      content: "",
      width:"500px"
      }, options);
      var mask = '<div id="artwl_mask"></div>';
      var boxcontain = '<div id="artwl_boxcontain">\
      <a id="artwl_close" href="javascript:void(0);" title="Close"></a>\
      <div id="artwl_showbox">\
      <div id="artwl_title">\
      <h2>\
      正在加載,請(qǐng)稍后...</h2>\
      </div>\
      <div id="artwl_message">\
      正在加載,請(qǐng)稍后...<br />\
      </div>\
      </div>\
      </div>';
      var cssCode = 'html, body, h1, h2, h3, h4, h5{margin: 0px;padding: 0px;}\
      #artwl_mask{background-color: #000;position: absolute;top: 0px;left: 0px;width: 100%;height: 100%;opacity: 0.5;filter: alpha(opacity=50);display: none;}\
      #artwl_boxcontain{margin: 0 auto;position: absolute;z-index: 2;line-height: 28px;display: none;}\
      #artwl_showbox{padding: 10px;background: #FFF;border-radius: 5px;margin: 20px;min-width:300px;min-height:150px;}\
      #artwl_title{position: relative;height: 27px;border-bottom: 1px solid #999;color:#444;font-size:14px;}\
      #artwl_close{position: absolute;cursor: pointer;outline: none;top: 0;right: 0;z-index: 4;width: 42px;height: 42px;overflow: hidden;background-image: url(/Images/thickboxclose.png);_background: none;}\
      #artwl_message{padding: 10px 0px;overflow: hidden;line-height: 19px;}';
      if ($("#artwl_mask").length == 0) {
      $("body").append(mask + boxcontain);
      $("head").append("<style type='text/css'>" + cssCode + "</style>");
      }
      else{
      $("#artwl_boxcontain").remove();
      $("body").append(boxcontain);
      }

      if (options.title != "") {
      $("#artwl_title").html(options.title);
      }
      if (options.content != "") {
      $("#artwl_message").html(options.content);
      }

      if($(window).width()>parseInt(options.width)){
      $("#artwl_boxcontain").css("width",options.width);
      }
      else{
      $("#artwl_boxcontain").css("width",$(window).width()-40+"px");
      }
      var height = $("#artwl_boxcontain").height();
      var width = $("#artwl_boxcontain").width();
      $("#artwl_mask").css("height",$("body").height()>$(window).height()?$("body").height():$(window).height()+"px").show();

      $("#artwl_boxcontain").css("top", ($(window).height() - height) / 2+$(document).scrollTop()).css("left", ($(window).width() - width) / 2).show();
      if ($.browser.msie && $.browser.version.substr(0, 1) < 7) {
      width = $(window).width() > 600 ? 600 : $(window).width() - 40;
      $("#artwl_boxcontain").css("width", width + "px").css("top", ($(window).height() - height) / 2).css("left", ($(window).width() - width) / 2).show();
      $("#artwl_mask").css("width", $(window).width() + "px").css("height", $(window).height() + "px").css("background", "#888");
      $("#artwl_close").css("top", "30px").css("right", "30px").css("font-size", "20px").text("關(guān)閉");
      }

      $("#artwl_close").click(function () {
      $("#artwl_mask").hide();
      $("#artwl_boxcontain").hide();
      });
      },
      artwl_close: function (options) {
      options = $.extend({
      callback: null
      }, options);
      $("#artwl_mask").hide();
      $("#artwl_boxcontain").hide();
      if (options.callback != null) {
      options.callback();
      }
      }
      });
      })(jQuery);

        測(cè)試地址:

      posted @ 2012-03-01 19:36  artwl  閱讀(24585)  評(píng)論(4)    收藏  舉報(bào)

      個(gè)人簡(jiǎn)介

      var ME = {
      	"name": "土豆/Artwl",
      	"job": "coding",
      	"languages": [
      		"JS", "HTML",
                      "CSS", "jQuery"
      		"MVC",".NET",
      		"設(shè)計(jì)模式"
      	],
      	"hobby": [
      		"閱讀", "旅游",
      		"音樂(lè)", "電影"
      	]
      }
      
      TOP
      主站蜘蛛池模板: 国产午夜精品在人线播放| 久久99精品国产99久久6男男| 又大又紧又粉嫩18p少妇| 午夜福利日本一区二区无码| 成在人线AV无码免观看| 苍井空一区二区波多野结衣av| 人妻性奴波多野结衣无码| 资源新版在线天堂偷自拍| 女人腿张开让男人桶爽| 亚洲男女羞羞无遮挡久久丫| 一区二区三区av天堂| 久久大香伊蕉在人线免费AV | 国产高清在线男人的天堂| 男人下部进女人下部视频| 午夜精品久久久久久久爽| 国产精品蜜臀av在线一区| 欧美亚洲国产一区二区三区| 东京热人妻无码一区二区av| 狠狠躁夜夜人人爽天96| 亚洲深夜精品在线观看| 汉源县| 天堂v亚洲国产v第一次| 免费无码又爽又刺激网站| 久久人人妻人人爽人人爽| 亚洲精品一区二区三区大| 亚洲精品国产一区二区三| 又黄又刺激又黄又舒服| 国产午夜精品理论大片| 视频一区二区三区四区久久| 亚洲AV无码国产永久播放蜜芽| 亚洲男女羞羞无遮挡久久丫| 国产漂亮白嫩美女在线观看| 无码AV动漫精品一区二区免费| 国产国拍亚洲精品永久软件| 不卡免费一区二区日韩av| 67194熟妇在线观看线路| 安宁市| 国产又色又爽又黄的视频在线 | 国产另类ts人妖一区二区| 亚洲一区二区三区啪啪| 国产成人毛片在线视频|