0

I have used the following code to add autplay to iframe video onclick.

Html:

<span id="stoprotate"></span><iframe src="http://www.youtube.com/embed/TJ2X4dFhAC0?wmode=transparent"  frameborder="0" class="slide" allowtransparency="true" id="video" wmode="opaque"></iframe>

script:

$(document).on('click','#video',function(e){ 

$(".roundabout-in-focus #video")[0].src += "&autoplay=1";
  $(this).unbind("click");

})

<a href="#">Stop auto play</a>

I need to remove autoplay on click the stopautoplay link. How to do that?

4

1 回答 1

0

更改我的答案:P 尝试使用全局变量来保存 url,然后在单击

var gurl;
$(document).on('click','#video',function(e){
    gurl =  $(".roundabout-in-focus #video")[0].src;
    $(".roundabout-in-focus #video")[0].src += "&autoplay=1";
    $(this).unbind("click");
});

我写了一个示例: http:
//ohcool.org/sof/13641740.html

于 2012-11-30T09:10:59.183 回答