0

我不擅长 javascript。我想知道是否可以创建类似于下面关于播放按钮的链接的内容,但我希望播放按钮覆盖视频,当单击按钮时,它会淡出并播放视频。

http://jsfiddle.net/bdougherty/HfwWY/

HTML

<iframe id="player1" src="http://player.vimeo.com/video/27855315?api=1&player_id=player1"
width="400" height="225" frameborder="0" webkitAllowFullScreen mozallowfullscreen    
allowFullScreen></iframe>

<p><button>Play</button>

JS

var iframe = $('#player1')[0],
player = $f(iframe),
status = $('.status');

// When the player is ready, add listeners for pause, finish, and playProgress
player.addEvent('ready', function() {
status.text('ready');

player.addEvent('pause', onPause);
player.addEvent('finish', onFinish);
player.addEvent('playProgress', onPlayProgress);
});

// Call the API when a button is pressed
$('button').bind('click', function() {
player.api($(this).text().toLowerCase());
});

function onPause(id) {
status.text('paused');
}

function onFinish(id) {
status.text('finished');
}

function onPlayProgress(data, id) {
status.text(data.seconds + 's played');
}

非常感谢。

4

0 回答 0