How to avoid "flickering"

By default, the javascript / jQuery code you write is executed at Document ready. This means that the whole page is loaded before your changes are made. This can sometimes cause “flickering”.

You can avoid this by changing the way Symplify executes javascript / jQuery. To do this you first have to add /* no_doc_ready */ at the top of the code in the javascript / jQuery tab.

/* Write custom javascript / jQuery here! */
/* no_doc_ready */



Then you need to make sure that the elements that you are referring to (changing/tieing changes to) exist before your code executes. The easiest way to do this is by checking that your elements exist with a Page Content fact in Audience. If you are doing changes to multiple elements you need to set a Page Content fact for each of these to be sure.

Notice that this might not be necessary if your content loads fast and all elements loads in at the same time. Then you can just set it to the element that is lowest in the HTML DOM.

 

mceclip0.pngIn the example above we do changes to the buy button on the page so we set up a Page Content fact in our Audience for that element's CSS selector.

 

 

 

Was this article helpful?
0 out of 0 found this helpful