Original jquery pop-up layer plugin sharing _jquery

Source: Internet
Author: User
Tags prev wrapper

Rely on jquery, compatible with mainstream browsers such as Ie6\7\8 Firefox Chrom (absolutely original), but ask the great God to help me improve efficiency.

/** * jquery Pop-up Layer plugin * * @author lanhaoooo@163.com * @since 2014-08-23 * * (function ($) {var methods = {o: { Isie:!-[1,] | | Document.documentmode >= 9,//is judged IE9, IE10 IE6:!-[1,] &&!window. XMLHttpRequest, Ie9_10:document.documentMode >= 9, Bglayer: "Layermodel_mask", Dataid: "Layermode L_main ", wrapper:" Layermodel_wrapper ", Warppercontent:" Layermodel_content ", Warppertitle:" LayerMod El_title ", warpperclosebtn:" Layermodel_closebtn ", Warpperowncontent:" Layermodel_owncontent ", replace
      Close: "Replaceclose", Dragableclass: "Dragable", defaultwidth:300}, Generateid:function () {
    Return "_" + New Date (). GetTime (); When Init:function (data, options) {//left and top want to use, set Center to false in such a way that this setting does not take effect if Center = True #666, #999 , #e5dfda, #e5e5e5, #ff8800 var defaults = {center:true,locked:true,fixed:true,drag:true,zindex:9999,opacity: "0.5 ", Title:" System Hint ", Staysame:false,width:0,height:0,timer:0,bgcolor:" #fffaf6 ", Left:350,top:100,head:true,isclose
          : True,shake:false, Close:function () {return true;
      }
        };
      options = $.extend (defaults, options);
      var s = this;
      var Generateid = S.generateid ();
        if (typeof data = = ' object ') {data = Data instanceof $. Data: $ (data);
        if (options.staysame) {data = S.createrender (data, Options, Generateid). Hide ();
        else {data = S.createcontainer (data, Options, Generateid). Hide (); ' Else if (typeof data = = ' String ' | | typeof data = = ' number ') {data = $ ("<div id= '" +s.o.dataid + ge
      Nerateid + "' ></div>"). HTML (data). Appendto (Document.body). Hide ();
        else {alert ("Layer error:unsupporte data type:" + typeof data);
      Return } if (options.locked &&!s.hasbglayer ()) {$ ("<div class= '" +s.o.bglayer+ "' id= '") + S.o.bglayer + "' ></div>"). Appendto (document.body). CSS ({"Background": Options.bgcolor, "opacity":
      Options.opacity}); } data.css ({"Position": Options.fixed? S.o.ie6?)
      "Absolute": "Fixed": "Absolute", "Z-index": Options.zindex, "left": Options.left, "Top": Options.top}). Show ();
        if (options.center) {s.fixlayer (data);
        $ (window). Bind ("Resize scroll", function () {s.fixlayer (data);
      });
      } if (Options.drag) {s.draglayer (data, options);
      } if (Options.shake) {s.shakelayer (data);
      } var TimeOut;
      Cleartimeout (TimeOut); if (Options.timer > 0) {timeOut = Window.settimeout (function () {$ ("#" +s.o.replaceclose + Generateid). T
        Rigger ("click");
      }, Options.timer);
    } return data;
      }, Createcontainer:function (data, Options,generateid) {var s = this; If the context is not defined, it is added by means of an HTML concatenation otherwise it would have existed, and it would need to return to the original local Var ishtmlSlice = Data.context = = undefined?
      True:false; var wrapperhtml = "<div class=" "+s.o.wrapper+" ' id= ' "+s.o.wrapper + generateid+" ' > "+" <div class = ' "+s.o.warppercontent+" ' id= ' "+s.o.warppercontent + generateid+" ' > "+" <a class= "" +s.o.replaceclose
                + "' id= '" +s.o.replaceclose + generateid+ "' ></a>"; if (options.head) {wrapperhtml+= "

The above is the entire contents of this article, I hope you can enjoy.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.