標題說明了一切。我得到了LI元素的列表。當點擊導航時,活動的li獲得「當前」類,但這需要一秒鐘。 但是,當我使用我的代碼,我需要點擊導航然後李打開,我需要再次點擊,使代碼註冊。 視頻的位置不能被硬編碼!它需要是動態的。onclick函數需要雙擊,因爲類分配延遲
(function($) {
$(document).ready(function(){
$('video').each(function() {
$(this).get(0).pause();
});
$('.slides').children('li').addClass('test');
});
$(document).on('click','span',function(){
if ($('li').hasClass('current')) {
$('li.test').find('video').each(function() {
$(this).get(0).pause();
});
$('li.current.test').find('video').each(function() {
$(this).get(0).play();
});
}
});
})(jQuery);
http://codepen.io/hennysmafter/pen/aNrVKG?editors=1010
不幸的是,我將無法用於接下來的一個小時左右,但之後會回來的!大家感謝你的幫助。
OP正在使用http://tympanus.net/codrops/2014/03/13/tilted-content-slideshow/ – Seblor