Reputation: 608
I write small page and in this code I have error. I want to use this way because Isotope doesn't read the width and height from 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 ';}',
.....
Upvotes: 0
Views: 133
Reputation: 998
As ajm and Amit Joki said, you need + operators to concatenate strings.
But, since $(window).width()
returns an unitless value, you need to add 'px' for it to be a valid css string:
var css = '.plmt { width:' + plmt_w + 'px; height:' + plmt_h + 'px;}',
Upvotes: 2
Reputation: 59272
Use +
operator to join the strings:
var css = '.plmt { width:' + plmt_w + '; height:' + plmt_h + ';}';
Upvotes: 1
Reputation: 20105
You need to use the +
operator to concatenate strings:
var css = '.plmt { width:' + plmt_w + '; height:' + plmt_h + ';}',
Upvotes: 0