Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在单击事件时用嵌入代码替换OWL转盘图像_Javascript_Jquery_Flash_Owl Carousel_Owl Carousel 2 - Fatal编程技术网

Javascript 如何在单击事件时用嵌入代码替换OWL转盘图像

Javascript 如何在单击事件时用嵌入代码替换OWL转盘图像,javascript,jquery,flash,owl-carousel,owl-carousel-2,Javascript,Jquery,Flash,Owl Carousel,Owl Carousel 2,我正在使用显示项目,现在我想将此嵌入代码替换为单击的图像: <embed src="http://sample.biz/scratch.swf" wmode="direct" quality="high" flashvars="project_filePath=http://sample.biz/public/upload/scratchproject/2016/02/Ignition.sb2" width="480px" height="400px" pluginspage="http:

我正在使用显示项目,现在我想将此嵌入代码替换为单击的图像:

<embed src="http://sample.biz/scratch.swf" wmode="direct" quality="high" flashvars="project_filePath=http://sample.biz/public/upload/scratchproject/2016/02/Ignition.sb2" width="480px" height="400px" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash">
jQuery部分:
var currentIndex=0;
$(文档).ready(函数(){
$(“#示例”).owlCarousel({
项目:5,
单项:对,
后移:函数(){
currentIndex=this.currentItem;
}
}).on('changed.owl.carousel',函数(属性){
currentIndex=property.item.index;
console.log(currentIndex);
});
});
$(document.body).on('click','example.item img',function(){
var数据=“”;
});

您可以使用
替换为

$(this).replaceWith(embedData);
希望这有帮助

var currentIndex = 0;
$(document).ready(function() {

  $("#example").owlCarousel({
    items: 5,
    singleItem: true,
    afterMove: function() {
      currentIndex = this.currentItem;
    }
  }).on('changed.owl.carousel', function(property) {
    currentIndex = property.item.index;
    console.log(currentIndex);
  });

});

$(document.body).on('click', '#example .item img', function() {
  var embedData = '<embed src="http://sample.biz/scratch.swf" wmode="direct" quality="high" flashvars="project_filePath=http://sample.biz/public/upload/scratchproject/2016/02/Ignition.sb2" width="480px" height="400px" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash">';
});
$(this).replaceWith(embedData);