Question

I want to use a javascript variable to calculate the columnWidth variable of the jQuery Masonry plugin. When I view source on my page, I see the variable name in the javascript rather than the variables value.

http://jsfiddle.net/robflate/fS2yL/

Thanks

Was it helpful?

Solution

Javascript is intepreted... it's normal that you see "return containerWidth / columns;" in your source code.

When the javascript will be interpreted, the value of "columns" will be used.

If it does not work, it's surelly because you set "columns" as a string ( "5" ) and not as an integer. The division can't be perfomed.

OTHER TIPS

That is expected - source will show what you loaded, it won't change the values. See this jsfiddle:

This will work as expected.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top