Rich-text Reply

Conditional Activation Code run multiple times

mattrobbux 10-27-15

Conditional Activation Code run multiple times

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 

JDahlinANF 10-27-15

Re: Conditional Activation Code run multiple times

"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 





mattrobbux 11-06-15

Re: Conditional Activation Code run multiple times

Thanks so much!!