gpt4 book ai didi

javascript - 转换Javascript Image Rotator播放Youtube视频

转载 作者:行者123 更新时间:2023-12-03 05:33:37 25 4
gpt4 key购买 nike

我希望有人可能对如何使javascript图像旋转器也播放youtube视频有一些建议...含义,而不是静态图片-播放视频,然后转到下一张照片。我没有创建此旋转器的代码,并认为我了解它的工作原理-只是无法缠住我的头来播放视频(如果可能的话)。创建网站的人似乎已经从Dynamic Drive获得了代码。这是代码:

var variableslide=new Array()
//variableslide[x]=["path to image", "OPTIONAL link for image", "OPTIONAL text description (supports HTML tags)"]


//configure the below 3 variables to set the dimension/background color of the slideshow

var slidewidth='546px' //set to width of LARGEST image in your slideshow
var slideheight='400px' //set to height of LARGEST iamge in your slideshow, plus any text description
var slidebgcolor='#000060'

//configure the below variable to determine the delay between image rotations (in miliseconds)
var slidedelay=6000

////Do not edit pass this line////////////////

var ie=document.all
var dom=document.getElementById

for (i=0;i<variableslide.length;i++){
var cacheimage=new Image()
cacheimage.src=variableslide[i][0]
}

var currentslide=0

function rotateimages(){
contentcontainer='<center>'
if (variableslide[currentslide][1]!="")
contentcontainer+='<a href="'+variableslide[currentslide][1]+'">'
contentcontainer+='<img src="'+variableslide[currentslide][0]+'" border="0" vspace="3">'
if (variableslide[currentslide][1]!="")
contentcontainer+='</a>'
contentcontainer+='</center>'
if (variableslide[currentslide][2]!="")
contentcontainer+=variableslide[currentslide][2]

if (document.layers){
crossrotateobj.document.write(contentcontainer)
crossrotateobj.document.close()
}
else if (ie||dom)
crossrotateobj.innerHTML=contentcontainer
if (currentslide==variableslide.length-1) currentslide=0
else currentslide++
setTimeout("rotateimages()",slidedelay)
}

if (ie||dom)
document.write('<div id="slidedom" style="width:'+slidewidth+';height:'+slideheight+'; background-color:'+slidebgcolor+'"></div>')

function start_slider(){
crossrotateobj=dom? document.getElementById("slidedom") : ie? document.all.slidedom : document.slidensmain.document.slidenssub
if (document.layers)
document.slidensmain.visibility="show"
rotateimages()
}

if (ie||dom)
start_slider()
else if (document.layers)
window.onload=start_slider

</script>

<b>
<ilayer id="slidensmain" width=&{slidewidth}; height=&{slideheight}; bgColor=&{slidebgcolor}; visibility=hide><layer id="slidenssub" width=&{slidewidth}; left=0 top=0></layer></ilayer>

因此,基本上,您可以将图像添加到数组variablelide []中。我想要的是一种可以通过该数组或通过其他方法向您添加youtube视频的方法...我敢肯定有一种方法可以做到-但不幸的是,我似乎无法在Google上找到正确的方法发生这种情况。有什么建议么???

最佳答案

这只是我的意见,但是您在问题中发布的代码充其量似乎是可疑的。我建议完全尝试其他方法。

我知道prettyphoto jQuery插件可以满足您的需求。我现在正在网站上同时使用它同时包含照片和视频的画廊。 http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/

关于javascript - 转换Javascript Image Rotator播放Youtube视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9466121/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com