XWidgetSoft Forum https://www.bbs.xwidget.com/ |
|
open multiple layers with delay https://www.bbs.xwidget.com/viewtopic.php?f=8&t=4066 |
Page 1 of 1 |
Author: | Jimking [ February 5th, 2014, 7:32 am ] |
Post subject: | open multiple layers with delay |
Guys can you help me with this function/script? I have a button and I want with a click on it to open 4 layers but with 0.5sec delay for each one (effect of a fan) Click Button = open->layer1, layer2-delay 0.5s, layer3-delay 1sec, layer4-delay 1.5sec Thanks in advance! |
Author: | hamid [ February 6th, 2014, 3:18 pm ] |
Post subject: | Re: open multiple layers with delay |
use this code: (don't forget to add [button1OnClick] to [OnClick] of button1 in the [function tab] of inspector) Code: function button1OnClick(Sender)
{ i=1 setTimeout("Visibler",500) } function Visibler() { eval('layer'+i).Visible=1 i+=1 if(i>4) { return; } setTimeout("Visibler",500) } |
Author: | Jimking [ February 6th, 2014, 4:33 pm ] |
Post subject: | Re: open multiple layers with delay |
Thanks hamid!!! Works great! ![]() But I would like to have a show/hide control.. How can I edit the code for this...? |
Author: | hamid [ February 6th, 2014, 7:58 pm ] |
Post subject: | Re: open multiple layers with delay |
Code: function button1OnClick(Sender)
{ i=1 setTimeout("Visibler",500) } function Visibler() { eval('layer'+i).Visible=!eval('layer'+i).Visible i+=1 if(i>4) { return; } setTimeout("Visibler",500) } |
Author: | hamid [ February 6th, 2014, 8:44 pm ] |
Post subject: | Re: open multiple layers with delay |
why i have used it that way (with return!!!); it could be simpler this way: Code: function button1OnClick(Sender)
{ i=1 setTimeout("Visibler",500) } function Visibler() { eval('layer'+i).Visible=!eval('layer'+i).Visible i+=1 if(i<=4) { setTimeout("Visibler",500) } } |
Author: | Jimking [ February 7th, 2014, 3:23 am ] |
Post subject: | Re: open multiple layers with delay |
Now it's perfect! Thanks man!!! ![]() |
Page 1 of 1 | All times are UTC - 8 hours |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |