Javascript 如何在我的幻灯片上设置iframe视频?
这是我的 这是滑块的脚本:Javascript 如何在我的幻灯片上设置iframe视频?,javascript,jquery,html,css,iframe,Javascript,Jquery,Html,Css,Iframe,这是我的 这是滑块的脚本: $(function() { $('#slides').crossSlide({ speed: 40, fade: 1 }, [ { src: 'img/photo-2.jpg', dir: 'up', alt: 'Our Business is to Encrypt and Secure Your Communications', href: '#' },
$(function() {
$('#slides').crossSlide({
speed: 40,
fade: 1
}, [
{ src: 'img/photo-2.jpg', dir: 'up', alt: 'Our Business is to Encrypt and Secure Your Communications', href: '#' },
{ src: 'img/photo-10.jpg', dir: 'down', alt: 'The Solution for Secured Communications and Privacy.', href: '#' },
{ src: 'img/photo-3.jpg', dir: 'up', alt: 'All Text and Phone Communications are Encrypted End-to-End.', href: '#' },
{ src: 'img/photo-4.jpg', dir: 'down', alt: 'Secured Communications for Law Enforcement and Public Officials.', href: '#' },
{ src: 'img/photo-5.jpg', dir: 'up', alt: 'Secured Communications for the U.S. Military.', href: '#' },
{ src: 'img/photo-6.jpg', dir: 'down', alt: 'The World Leader in Encrypted Communications.', href: '#' },
{ src: 'img/photo-7.jpg', dir: 'down', alt: 'The Solution for Corporate Executives, Law Enforcement, Homeland Security, Goverment Agencies and more...', href: '#' }
/* */
], function(idx, img, idxOut, imgOut) {
if (idxOut == undefined) {
if(idx == 0 || idx == 3 || idx == 6 || idx == 9){
document.getElementById('crossSlideCaption').style.marginTop = '-425px';
document.getElementById('crossSlideCaption').style.marginLeft = '-480px';
}else if(idx == 1 || idx == 4 || idx == 7 || idx == 10 || idx == 12){
document.getElementById('crossSlideCaption').style.marginTop = '-425px';
document.getElementById('crossSlideCaption').style.marginLeft = '-480px';
}else{
document.getElementById('crossSlideCaption').style.marginTop = '-425px';
document.getElementById('crossSlideCaption').style.marginLeft = '-480px';
};
$('div.caption').text(img.alt).animate({ opacity: 1.0 })
} else {
//$('div.caption').animate({ opacity: 0 })
}});
$('div.caption').show().css({ opacity: 0 })
});
现在一切正常,现在我需要添加iframe视频到我的幻灯片中作为标题
我的视频大小为420x234像素,以下是iframe视频的代码:
<iframe src="//fast.wistia.net/embed/iframe/bqur1fvyag?videoFoam=true" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" allowfullscreen mozallowfullscreen webkitallowfullscreen oallowfullscreen msallowfullscreen width="720" height="433"></iframe>
<script src="//fast.wistia.net/assets/external/E-v1.js"></script>
但是我是空白,我如何才能添加我现有的代码
有人能帮我做到这一点吗
提前感谢。以下是我的答案:
<script>
wistiaEmbed = Wistia.embed("bqur1fvyag", {
videoFoam: {
maxWidth: 420,
maxHeight: 234
},
plugin: {
"socialbar-v1": {
buttons: ""
}
}
});
</script>
wistiaEmbed=Wistia.embed(“bkur1fvyag”){
视频泡沫:{
最大宽度:420,
最大高度:234
},
插件:{
“socialbar-v1”:{
按钮:“
}
}
});
您是否试图将此iframe附加到您的“#交叉幻灯片选项”
?然后只需将$('div.caption').text(img.alt)
更改为$('div.caption').html(img.alt)
,并将代码粘贴到alt
属性中,但我觉得这是一个奇怪的请求……我需要字幕以及iframe video@kaido。。thanks@Kaiido:我在alt属性中已经有标题了,对吗?那个么我怎样才能在alt属性中添加代码呢?那个么你们需要像在slider中的其他图像一样附加iframe,或者你们需要它在其中一个图像的标题中(对于第二个假设)是的,我需要在右侧添加标题,也需要在左侧添加iframe。。。我需要这两个为所有的图像silder。。谢谢