Assuming this is in a scroll event, so it gets fired a whole bunch:

element.setStyle('top', 100);

or:

if(element.getStyle('top') != '100px') element.setStyle('top', 100);

?

The first doesn't care, it just sets the style 100 times in a row.

The second checks if it even needs to set it.

So is the logic to find out more intense than just doing it anyway? I imagine it is but I'm often surprised.

Ryan Florence

[Introducing MooDocs - become a better developer]( http://blog.flobro.com/ )



Reply via email to