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

Était-ce utile?

La 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.

Autres conseils

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

This will work as expected.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top