Monday, November 12, 2012

jquery – fastest way to find element position using javascript?

I\’ve used jquery\’s offset().top, but when running it 4000 times in a loop the browsers freezes for a few seconds. Is there a faster way to get this?


This is happening on the iPAD the desktop is faster.



for (counter=1; counter<4000; counter++)
{
yPos = Math.round($(\"#star_\"+counter).offset().top);






Rating: 1 out of 5 based on 3 ratings



The post jquery – fastest way to find element position using javascript? appeared first on Javascript ASK.






via Javascript ASK http://javascriptask.phpfogapp.com/jquery-fastest-way-to-find-element-position-using-javascript.html

No comments:

Post a Comment