Jump to content

$i++ increment by 3000 instead of 1


shortysbest

Recommended Posts

$b=0;
$c=0;
$d=200;
$e=3000;
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{ ?>
<script>$(document).ready(function(){
setTimeout(function () {$(".p<?php print $b++?>").fadeIn("slow");}, <?php print $d ?>;
setTimeout(function () {$(".p<?php print $c++?>").fadeOut("fast");}, <?php print $e ?>);
});</script>

 

I want $d to go 200,400,600,800,1000, etc.

and $e to go 3000,6000,9000,12000, etc.

 

$b=0;
$c=0;
$d=0;
$e=0;
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{ 
$d += 200;
$e += 3000;?>
<script>$(document).ready(function(){
setTimeout(function () {$(".p<?php print $b++?>").fadeIn("slow");}, <?php print $d ?>;
setTimeout(function () {$(".p<?php print $c++?>").fadeOut("fast");}, <?php print $e ?>);
});</script>

oh.. i guess i had the wrong thing in my head as to what  i needed, as those do print out the correct numbers as i asked for i made a mistake i need the array to end up looking similar to this:

 

$(document).ready(function(){
setTimeout(function () {$(".p1").fadeIn("slow");}, 100);
setTimeout(function () {$(".p1").fadeOut("fast");}, 5100);
setTimeout(function () {$(".p2").fadeIn("slow");}, 5300);
setTimeout(function () {$(".p2").fadeOut("fast");}, 8300);
setTimeout(function () {$(".p3").fadeIn("slow");}, 8500);
setTimeout(function () {$(".p3").fadeOut("fast");}, 11500);
setTimeout(function () {$(".p4").fadeIn("slow");}, 11700);
setTimeout(function () {$(".p4").fadeOut("fast");}, 14700);
setTimeout(function () {$(".p5").fadeIn("slow");}, 14900);
setTimeout(function () {$(".p5").fadeOut("fast");}, 17900);
setTimeout(function () {$(".p6").fadeIn("slow");}, 18100);
setTimeout(function () {$(".p6").fadeOut("fast");}, 21100);
setTimeout(function () {$(".p1").fadeIn("slow");}, 21300);
});

 

so i would need to add 200, then 3000, then 200, then 3000 to the same number.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.