javascript - Unexpected string in JS with CSS -
i write small page , in code have error. want use way because isotope doesn't read width , height styles in html tags.
var winw = $(window).width(); var plmt_w = winw / 10; var plmt_h = plmt_w; var css = '.plmt { width:' plmt_w '; height:' plmt_h ';}', .....
as ajm , amit joki said, need + operators concatenate strings.
but, since $(window).width()
returns unitless value, need add 'px' valid css string:
var css = '.plmt { width:' + plmt_w + 'px; height:' + plmt_h + 'px;}',
Comments
Post a Comment