Modify the Dialog dialog box plugin in jquery as a way to frame pages (IFRAME) _jquery

Source: Internet
Author: User
jquery has a very good UI plug-in, dialog plug-ins, his official website has various forms of demonstrations: http://jqueryui.com/demos/dialog/, may be used more or its default mode, the specific use of the judge on the Internet, Also have Chinese explanation address, I will not repeat, recently in the pop-up frames page, carefully look, and dialog plug-in modal form mode is very similar, demo demo effect: http://www.lovewebgames.com/addNews.aspx

Is such an effect, to login registration pop-up layer, as for why I do not directly with modal form to do it? Because I like it, you care about me. So I made a jquery. The following dialog plug-ins need to refer to the original dialog file. The specific code is as follows:

Copy Code code as follows:

(function ($) {
$.fn.openwidow = function (options) {
var divid = "Dialog" + Math.Round (math.random () * 100);
var settings = {
Id:divid,
WIDTH:300,
HEIGHT:200,
Modal:true,
Buttons: {
},
Show: "Explode",
Hide: "Highlight",
Title: "Hint",
URL: "/test.aspx",
Close:function () {
$ ("#" + this.id). Remove ();
Debugger
if (document.getElementById (this.id))
Document.body.removeChild (document.getElementById (this.id));
}
};
if (options) {
$.extend (settings, options);
}
$ ("Body"). Append (' <div id= "' + settings.id + '" title= "Dialog title" ><p class= "Loading" ></p></div > ');
Dialog
$ (' # ' + settings.id). Dialog ({
Autoopen:false,
Title:settings.title,
Width:settings.width,
Height:settings.height,
Modal:true,
Bgiframe:true,
Show:settings.show,
Hide:settings.hide,
Buttons:settings.buttons,
Close:settings.close,
Open:function () {
$ ("#" + settings.id). html (' <iframe src= ' + settings.url + ' "frameborder=" 0 "height=" 100% "width=" 100% "id=" Dialogfra Me "scrolling=" Auto "></iframe>");
},
Resizestop:function () {
$ ("#dialogFrame"). CSS ("width", parseint (This). CSS ("width")-5);
$ ("#dialogFrame"). CSS ("height"), parseint ($ (this). CSS ("height")-5);
}
});

$ (' # ' + settings.id). Dialog ("Open");
return this;
};
}) (JQuery);

I think we should all understand, there is nothing complicated, that is, repeat and repeat the work. Even a lot of parameters themselves are dialog, I just added a layer of skin. I believe this method is a lot of beginners want to use, after all, not everyone likes and skilled use of Ajax, so this time the use of IFrame is still very large.

And hope that interested friends to join my Q group: 70210212, 5678537, usually more than the communication, there are problems without a person to think.

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.