Question

I'm using Cycle2 (http://jquery.malsup.com/cycle2/) slideshow plugin to show images on my web site. The problem is when I want to show a video together with my images, css from Cycle2 disables controls of youtube video.

This is the code I use to display images and video:

<div class="cycle-slideshow" 
data-cycle-fx=scrollHorz 
data-cycle-timeout=2000
data-cycle-pause-on-hover="true"
data-cycle-slides=">a,>img"
data-cycle-youtube=true
data-cycle-youtube-autostart=true
data-cycle-youtube-autostop=true >

    <div class="cycle-pager"></div>
    <img src="http://jquery.malsup.com/cycle2/images/p1.jpg">
    <img src="http://jquery.malsup.com/cycle2/images/p2.jpg">
    <img src="http://jquery.malsup.com/cycle2/images/p3.jpg">
    <img src="http://jquery.malsup.com/cycle2/images/p4.jpg">
    <a href="http://www.youtube.com/v/zugLQF3uLmk?version=3&hl=en_US&rel=0">Video</a>
</div>

I used a fractions of code from couple of demos. This is my CSS:

.cycle-slideshow { max-width: 640px; margin: 10px auto }
.cycle-slideshow > div { width: 100%; height: 100% }
.cycle-slideshow > img { width: 100%; height: 100% }
iframe,object,embed { width: 100%; height: 100% }

/* in case script does not load */
.cycle-slideshow img:first-child {
    position: static; z-index: 100;
}

/* pager */
.cycle-pager{ 
    text-align: center; width: 100%; z-index: 500; position: absolute; top: 10px; overflow: hidden;
}
.cycle-pager span { 
    font-family: arial; font-size: 50px; width: 16px; height: 16px; 
    display: inline-block; color: #ddd; cursor: pointer; 
}
.cycle-pager span.cycle-pager-active { color: #D69746;}
.cycle-pager > * { cursor: pointer;}


/* caption */
.cycle-caption { position: absolute; color: white; bottom: 15px; right: 15px; z-index: 700; }


/* overlay */
.cycle-overlay { 
    font-family: tahoma, arial;
    position: absolute; bottom: 0; width: 100%; z-index: 600;
    background: black; color: white; padding: 15px; opacity: .5;
}

/* display paused text on top of paused slideshow */
.cycle-paused:after {
    content: 'Paused'; color: white; background: black; padding: 10px;
    z-index: 500; position: absolute; top: 10px; right: 10px;
    border-radius: 10px;
    opacity: .5; filter: alpha(opacity=50);
}

/* 
    media queries 
    some style overrides to make things more pleasant on mobile devices
*/

@media only screen and (max-width: 480px), only screen and (max-device-width: 480px) {
    .cycle-slideshow { width: 200px;}
    .cycle-overlay { padding: 4px }
    .cycle-caption { bottom: 4px; right: 4px }
}

I set for that video to play automatically when it comes on front and if user holds a cursor above that video, the slide will not change. If user remove cursor, next slide will show after 2 seconds pass. Also, there is a pager above to so user can manually switch to certain image/video.

This is how it looks:

enter image description here

First four dots represent images and the last one is video. The problem is I can't access controls (pause, play, mute, click on name of the video ...) of the video. They immediately disappear after video begins to play.

Thank you.

Was it helpful?

Solution

I think the video is overlapped by the pager. Try giving a height to the pager.

.cycle-pager{ 
   height:50px;
}

Also you can check if the youtube video controllers are working or not by removing the z-index given to .cycle-pager.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top