Thursday, May 16, 2013

css munging in jquery

jQuery obviously has many tools for manipulating the css styles of individual items and classes of items, but sometimes you just want to glom some stuff as a tag of css so it applies to new stuff as well.
The stackoverflow page jQuery create CSS rule / class @ runtime has some decent solutions. My favorite is:
    .prop("type", "text/css")
    #my-window {\
        position: fixed;\
        z-index: 102;\
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