Hi All,
I’ve got a page working fine in preview, but when live the timing is out. I’ve realised it’s due to the image.hide fade-out duration appearing to be asynchronous. In preview, it runs a little slower so the timing works, but purely by chance! In live it’s quicker and the timing error shows!
I’ve added an await before each fade out, it works, but sequentially, but I want them all to fade out together and wait until all are done before proceeding.
Note this code is already within an asnyc function on button click.
// Fade out the waiting images… but they fade sequentially…
await $w( " #image1 " ).hide( “fade” , fadeOptions);
await $w( " #image2 " ).hide( “fade” , fadeOptions);
await $w( " #image3 " ).hide( “fade” , fadeOptions);
So I tried…
await {
$w( " #image1 " ).hide( “fade” , fadeOptions);
$w( " #image2 " ).hide( “fade” , fadeOptions);
$w( " #image3 " ).hide( “fade” , fadeOptions);
}
And it didn’t like that! Is there any way to include several expressions within the single await? I’m guessing I’m going to have to create an async function, then call and wait for that?
Something like…(pseudo code!)
Async Function (FadeImages) {
$w( " #image1 " ).hide( “fade” , fadeOptions);
$w( " #image2 " ).hide( “fade” , fadeOptions);
$w( " #image3 " ).hide( “fade” , fadeOptions);
}
Then call that function within the button click code, something like
Await FadeImages
But is there a way to do it without having the additional function and calling it?
Thanks for any help, it’s very much appreciated.
Cheers,
Andy.