The stackoverflow page jQuery create CSS rule / class @ runtime has some decent solutions. My favorite is:
$("<style>")
.prop("type", "text/css")
.html("\
#my-window {\
position: fixed;\
z-index: 102;\
display:none;\
top:50%;\
left:50%;\
}")
.appendTo("head");
Admittedly, I was doing fancier stuff to put into the .html tag (so all the string continues on next line slashes weren't needed) but still, it got the job done.
No comments:
Post a Comment