If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Featured Content Slider. Youtube video donīt stop when slider changes

3) Describe problem: First to all, thanks for sharing your knowledge. You are GREAT! (sorry for my english)
My problem comes when I try to insert videos from YouTube in the slider (by php), when a video is in play, and the slider changes, this video continues to run below the second. (with "display:none;" still run) would be great to get that when the slider changes (because you clik on a thumbnail) , the video on play stops. Could you help me pleaseee
Thank you very much for your time and effort. (Youtube video are insert by <iframe> to validate, <embed> doesnīt work)

You can use the script's onchange event handler to insert custom code to execute whenever the slider changes slides. It is automatically fed two parameters, the index of the last slide viewed, and the index of the current visible slide:

Code:

onChange: function(previndex, curindex){
//custom code here
}

When the Slider first loads on the page, the two parameters point to the same slide. The count starts at 1, meaning 1 indicates the 1st slide, 2 the second etc. One sample usage is to stop a video playing on the previous slide when a new slide is brought up:

Code:

onChange: function(previndex, curindex){
if (previndex==curindex) //if two indices point to the same slide (page first loads)
return //do nothing
else if (previndex==1)
videoplayer.stop("cats")
else if (previndex==2)
videoplayer.stop("dogs")
else if (previndex==3)
videoplayer.stop("myvacation")
}

This assumes videoplayer.stop() is some function that stops the playing of a video inside your slides.

In the case of stopping a Youtube video, based on the details provided here, apparently the function to call is:

Code:

document.getElementById('playerid').stopVideo()

where "playerid" is the ID given to the EMBED element that displays the Youtube video to stop it.