
Originally Posted by
ddadmin
Hmm this one is a little tricky, as YouTube videos are embedded via IRAME tags that in turn houses a Flash object. Flash objects by default do not make available events occurring inside them to JavaScript. One somewhat passable solution is to stop the video when the mouse rolls over the player (instead of onclick), by overlaying the carousel with a transparent DIV that reacts to the mouseover event. To do this, inside stepcarousel.js, add the code in red to the init() function:
Code:
init:function($, config){
config.gallerywidth=config.$gallery.width()
var transdiv = $('<div style="position:absolute; width:100%; height:100%; top:0; left:0; background:white; opacity:0; z-index:1000" />').appendTo(config.$gallery)
transdiv.bind('mouseover', function(){
config.autostep.status="stopped"
stepcarousel.stopautostep(config)
})
This should work in stopping the carousel from stepping as soon as the user mouses over the carousel.
The other, "real" solution is to embed the youtube video dynamically using JavaScript, then taking advantage of the available functions of Google's Youtube API:
https://developers.google.com/youtub..._api_reference That route obviously is a lot more involved.
Oh! Now we're awesomely close to perfection. The only other thing I would "want", and I'm not sure how difficult this would be is to have it also process the mouseOut and resume sliding?
Code:
init:function($, config){
config.gallerywidth=config.$gallery.width()
var transdiv = $('<div style="position:absolute; width:100%; height:100%; top:0; left:0; background:white; opacity:0; z-index:1000" />').appendTo(config.$gallery)
transdiv.bind('mouseover', function(){
config.autostep.status="stopped"
stepcarousel.stopautostep(config)
})
transdiv.bind('mouseoout', function(){
config.autostep.status="stopped"
stepcarousel.stopautostep(config)
})
Maybe? Just a stab in the dark here. I should go through and read all of the code for this script, but I'm on such an insane time crunch for this page
.
Thank you so much for your help thus far!!
Bookmarks