badwolfff
asked on
Why is my Jquery code behaving strangely?
Hi
Within the HTML file you will find that I have 5 child divs under the #sitedivs.
With this line of code I am trying to set each of the children's css "left" value
Strangely this code does nothing at all.
However if instead of "i" value I were to put in real numerical values, it work, as shown below:
Please help as this is damned maddening!
thanks in advance
SITO.zip
Within the HTML file you will find that I have 5 child divs under the #sitedivs.
With this line of code I am trying to set each of the children's css "left" value
for (i=0; i<$("#sitedivs").children().length-1; i++)
{
$("#sitedivs div:eq(i)").css("left", i*$(window).width()+"px" );
//alert(i);
}
Strangely this code does nothing at all.
However if instead of "i" value I were to put in real numerical values, it work, as shown below:
$("#sitedivs div:eq(3)").css("left",3*$(window).width()+"px" );
Please help as this is damned maddening!
thanks in advance
SITO.zip
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window