javascript - Function to change variables in CSS file? -


is there function take custom css file , change variables fheight , fwidth output screen.height , screen.width, respectively? trying build js reveal presentation using percentages position elements, , understand properties height, top, , bottom accept percentages values if dimensions of parent element specified. cannot specify dimensions of slide using other javascript functions screen.height , screen.width because want presentation work on displays of size. there r, javascript, or other language function take custom css file variables fheight , fwidth input, , return css file variables replaced pixel values?

i want css file like:

html, body{     height: fheight;     width: fwidth; } 

after html , body elements' height , width set dimensions of display, think percentages specify height , position work.

what looking possible sass: http://sass-lang.com/

however, normal css allow variables in way described. if sass not option, use neil's suggestion , change them using jquery's css function (or if prefer native js style attribute)

jquery: $("body").css({'height': '55px', 'width': '99px';}); read more: http://api.jquery.com/css/

vanilla js: document.body.style.width= fwidth; read more: set css property in javascript? or http://www.w3schools.com/js/js_htmldom_css.asp

hope started , luck.


Comments