Solution for object toggle using automatic/calculated intervals

I’m trying to design a page on one of my sites, where the visibility of a bunch of images are toggled using calculated intervals and automatically. The javascript equivalent is the function setInterval(function, milliseconds, param1, param2, …) Is there a way to achieve the same in wix? I had no luck in the code section. Kindly advise, Thanks!!

Hi abolinia,

Here is the Set Interval function :

setInterval(function(){
 $w("#element").show();//element is hidden on load, being visible after 5 seconds
 }, 5000);//time millisecond 

hope this helps!
Best,

Mustafa

Thanks a lot Mustafa, this works perfectly! One more question you might be able to help -

Is there a solution in Wix for receiving messages from another site/domain? My use case is -

I need to show or hide logos/images in Wix, however based on matching values of a variable inside a html/js hosted in another domain, for which I’m using the post method. The values in the variable is programmed to change, which is basically the location of many offices, which is displayed one by one on a spinning globe. So when the globe spins to a certain office or the variable includes a certain value, this needs to be passed on to the wix page where the matching company logos will be displayed.

Normally I would use .addEventListener to receive the cross-domain messages and make this work. Any ideas on if this would be possible?

Thanks!!!

Ok nevermind. I found the resource at Velo: Working with the HTML iframe Element | Help Center | Wix.com and I have the prototype working now. Thanks for earlier again!

1 Like