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

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -