Feel free to check out the CodePen example: http://codepen.io/frankDraws/pen/RWgBBw
Overview: This CodePen features an ad with a video carousel that utilizes SlickJS.
There are a total of 3 YouTube videos included in the carousel, with the SlickJS 'infinite' option enabled.
Challenges: 1. The task at hand is to ensure that the placeholder image disappears permanently upon clicking, even for the cloned elements. 2. Additionally, the YouTube video should pause when navigating between slides (including the clones). 3. It would be beneficial to streamline the final code for better efficiency.
Currently, the placeholder image disappears upon click, but reappears when scrolling through the carousel (depending on the clicked image and direction of scrolling).
My assumption is that somewhere in the SlickJS script, the image is being reinstated. Unfortunately, I am unsure of where in the SlickJS code this action occurs, and I am struggling to override it.
I have experimented with various approaches, such as:
$("#c1").on('click',function(){
$(this).html('<iframe id="video01" width="100%" height="100%" src="http://www.youtube.com/embed/c07DH4HY2CA?list=&wmode=opaque&rel=0&modestbranding=0&showinfo=0&autoplay=1&controls=0&enablejsapi=1" frameborder="0" allowfullscreen="" style="width:305px; outline: 5px solid #fff; background:#000; margin:0 0 0 4px; padding:0"></iframe>');
$("#c1 > img").hide();
});
$("#c2").on('click',function(){
$(this).html('<iframe id="video01" width="100%" height="100%" src="http://www.youtube.com/embed/1bdtSFxBYW0?list=&wmode=opaque&rel=0&modestbranding=0&showinfo=0&autoplay=1&controls=0&enablejsapi=1" frameborder="0" allowfullscreen="" style="width:305px; outline: 5px solid #fff; background:#000; margin:0 0 0 4px; padding:0"></iframe>');
$("#c2 > img").hide();
});
$("#c3").on('click',function(){
$(this).html('<iframe id="video01" width="100%" height="100%" src="http://www.youtube.com/embed/Js_Jv5EzOv0?list=&wmode=opaque&rel=0&modestbranding=0&showinfo=0&autoplay=1&controls=0&enablejsapi=1" frameborder="0" allowfullscreen="" style="width:305px; outline: 5px solid #fff; background:#000; margin:0 0 0 4px; padding:0"></iframe>');
$("#c3 > img").hide();
});
I have also attempted utilizing
$("#c3 > img").style.display = "none";
, among other methods, but unfortunately, none have resolved the issue.
Your assistance in tackling this challenge is greatly appreciated.