Iframe extension of jquery. boxy plug-in
The Code is as follows:
/*
The w, h, and src attributes remain unchanged for the Boxy attribute.
QBox. Close (); Close the current window
QBox. iFSrc ({}); changing the properties of the current window and adding the w, h, and src attributes to the Boxy attribute
*/
// Boxy Extension
JQuery. fn. qbox = function (options ){
Var node = this. get (0). nodeName. toLowerCase ();
Var self = this;
If (node = 'A '){
$ (This). attr ('onclick', ''). unbind ('click'). click (function () {return false ;});
Options = $. extend (options | {}, {src: this. get (0 ). getAttribute ('href '), beforeUnload: function () {$ (self ). unbind ('click '). click (function () {return $ (this ). qbox (options );});}});
}
QBox. iFLoad (options );
Return false;
}
Var qBox = function (){};
JQuery. extend (qBox ,{
ADgs: [],
IFrame: function (op ){
Op = jQuery. extend ({title: 'hint', w: 320, h: 200, src: 'about: blank ', modal: false, fixed: false, unloadOnHide: true }, op), fm = parseInt (Math. random () x (1000*987 ));//
Var dialog = new Boxy ("Loading. Please wait ....", Op );
JQuery ("# _" + fm). load (function (){
Dialog. resize (op. w, op. h, function (){});
JQuery ("# ld" + fm). remove ();
JQuery ("# _" +fm).css ({'padding': '15px ', 'display ':''});
});
QBox. aDgs. push (dialog );
Return false;
},
Close: function (){
QBox. aDgs [qBox. aDgs. length-1]. hide ();
Return false
},
IFSrc: function (op ){
Op = jQuery. extend ({w: 320, h: 200, src: 'about: blank '}, op );
QBox. aDgs [qBox. aDgs. length-1]. getContent (). attr ("src", "about: blank ");
QBox. aDgs [qBox. aDgs. length-1]. setTitle (op. t );
QBox. aDgs [qBox. aDgs. length-1]. tween (op. w, op. h, function () {qBox. aDgs [qBox. aDgs. length-1]. getContent (). attr ("src", op.src).css ({width: op. w, height: op. h });});
Return false;
},
IFLoad: function (options ){
Var sr = jQuery (this). attr ("href ");
Var op = jQuery. extend ({src: sr}, options );
QBox. iFrame (op );
Return false;
}
});
Source: cn795.cnblogs.com