- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Conditional Activation Code run multiple times
Conditional Activation Code run multiple times
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
Hi all,
I need some help with regards to the activation code.
I am testing when a user clicks on a video thumnail which opens up a lightbox and autoplays the video.
My issue is that in my condition I wait for the lightbox to be opened before my code is fired. However when a user open a lightbox the video autoplays. Id they close ii and open another lightbox the video doesnt autoplay.
I would like my code to fire mutiple times and not only the first time a user opens a lightbox.
Activatio code - $("[id^=lightbox-gal]").hasClass("visible") && $(".video-loader").attr("style")
Any help would be much apprecuated.
Thanks a lot
Re: Conditional Activation Code run multiple times
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
"Activation" is for adding someone to an experiment. Seems like that part is working fine.
It sounds like you want your experiment's code to run once upon activation and then again every time someone opens a lightbox.
Something like this should work.
1- define a function that is the changes you want to make
2- set an event listener that calls the function in #1 - this should run whenever someone opens the modal a second time (this will probably need to listen to a trigger though... the lightbox may not exist yet when 'click' happens.)
3- run the function once during activation
window.formatLightBox_Optimizely = function(){ //Do some stuff ot the lightbox }; window.$('.some-selector').on('click',function(){ window.formatLightBox_Optimizely(); }); window.formatLightBox_Optimizely();
Re: Conditional Activation Code run multiple times
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
Thanks so much!!