archived-repos / css.js

MIT License
0 stars 0 forks source link

Using this with jqLite #1

Open RongBranovate opened 9 years ago

RongBranovate commented 9 years ago

Hi @jgermade !

You may remember me from the jqlite project. I am looking for a way to inject CSS through JS dynamically and i was wondering, can i use this library with jqlite? And if so, can i have some examples? How would you add this code:

".myClass": {
        text-indent: -9999px,
        width: 16px,
        height:16px,
        border: none,
        margin-left: 15,
        margin-right: 15,
        cursor: pointer
    }

and this:

.media-player input[type='range']::-webkit-slider-thumb
{
-webkit-appearance:none;
border: 1px solid #000000;
height:36px;
width:16px;
border-radius:3px;
background:#ffffff;
cursor:pointer;
margin-top:-14px;
box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
};

thanks in advance!

jgermade commented 9 years ago

Hi @RongBranovate

If you use latest version of jqlite (v0.2.4), you can do following:

$('.myClass').css({
        textIndent: '-9999px',
        width: '16px',
        height: '16px',
        border: 'none',
        marginLeft: 15,
        marginRight: 15,
        cursor: 'pointer'
    });

basically replace css properties by camelCase version, not sure if you can reach an element with '::-webkit-slider-thumb' selector

thanks for your feedback @RongBranovate !!

jgermade commented 9 years ago

css.js is just a single tool to transform a css string into html:

article#item-id.parent.element[data-some="attribute"] section.post a.link

to

<article id="item-id" class="parent element" data-some="attribute"><section class="post"><a class="link"></a></section></article>
RongBranovate commented 9 years ago

Hi @jgermade , yeah, i understand, and you ware right... you can't use psudo elements in jquery .css() function... too bad :(