html - Javascript addRule multiple selectors -
i'm experimenting addrule on css in html. works fine if this:
document.stylesheets[0].addrule("#" + id + ':hover', 'max-height: ' + desiredheight + 'px;');
where id , desiredheight variables set. applies max-height when hover on element. question this: how can add structire this:
body.link, body.appadd, body.pagelike { #id:hover{ overflow:hidden; maxheight: 400px; } }
please ;)
that structure has compiled down pure css before browser can understand it.
so in particular case, like:
document.stylesheets[0].addrule( 'body.link #'+id+':hover, body.appadd #'+id+':hover, body.pagelike #'+id+':hover, ', 'max-height: ' + desiredheight + 'px;' );
but if using id in 1 place recommended, you'll need (what have):
document.stylesheets[0].addrule( '#'+id+':hover', 'max-height: ' + desiredheight + 'px;' );
Comments
Post a Comment