Write some articles before using the boxy pop-up (see Jquery.boxy Basics) today is mainly in the solution of a need, feel that it is worth recording down, so write another, the main function is, in the pop-up dialog box, after every n seconds automatically hidden, there is automatic jump!
effect as shown:
and the encapsulated code is as follows:
Copy Code code as follows:
Boxy dialog box extension
var boxy_extensions = {
Options: {
Title: ' Art Bar hint ',
Closetext: ' x '
},
Hide after n seconds after popup
Alertdelayfun:function (info, timer, options) {
Options = $.extend (this.options, Options | | {});
New Boxy ("<div style= ' padding-left:50px;padding-right:50px;text-align:center;font-size:14px; > "+ info + </div>", $.extend ({behaviours:function () {
SetTimeout (' $ ('. Boxy-wrapper '). Hide (); ', Timer ';
}
}, Options));
},
After pop-up, auto jump
Alerthreffun:function (info, href, options) {
Options = $.extend (this.options, Options | | {});
New Boxy ("<div style= ' padding-left:50px;padding-right:50px;text-align:center;font-size:14px; > "+ info + </div>", $.extend ({behaviours:function () {
location.href = href;
}
}, Options));
}
}
Because the options attribute is public, it is presented, and each method has its own options, and if you pass the options when calling your own method, the $.extend will
With the contents of the options attribute in the class to merge (covering the key value, extend the new key value), it seems to write JS should also follow the principle of object-oriented, hehe!