This article mainly introduces how to execute subsequent code after loading css. If you need it, refer to the framework of the recently written project and write a JQueryMessageBox class to use jquery callback, the Code is as follows:
// If the ui. js is not included, reference if ($ ('script [src $ = "" jquery-ui-1.8.11.custom.min.js? 1.1.23 ""] '). length = 0) {$ (""""). AppendTo ('head') ;}// if no css is loaded, load if ($ ('link [ref $ = "" jquery-ui-1.8.14.custom.css? 1.1.23 ""] '). length = 0) {$ ('
'). AppendTo ('head'); // dialog () script }}
But the CSS code will not be loaded immediately, so there will be no style when the dialog is displayed (in IE9, you can, because in IE9, CSS will be downloaded even later, the page elements will be re-drawn, but IE8 won't ). to solve this problem, you can use ajax to display the dialog after the css is loaded. The Code is as follows:
If ($ ('link [ref $ = "" jquery-ui-1.8.14.custom.css? 1.1.23 ""] '). length = 0) {$. ajax ({url: '/css/jquery-ui-1.8.14.custom.css', success: function (data) {// create a style element, and append it to the head. // Replace the images path $ (''). AppendTo ('head'); // dialog () script ;}});} else {// dialog () script ;}