轮播视频点击弹窗播放
<div id="intro" class="banner">
<?php if( have_rows('slider') ): $i = 0; ?>
<div class="swiper-container swiper" >
<div class="swiper-wrapper">
<?php while( have_rows('slider') ): the_row();
$i++;
?>
<div class="swiper-slide" id="li<?php echo $i;?>" data-gnslide-id="<?php echo $i;?>" data-video-url="获取视频地址字段" style="background-image:url()"></div>
<?php endwhile; ?>
</div>
</div>
<?php endif; ?>
<a href="#" class="slider-down-arrow"></a>
</div>
<div class="modal-video">
<div class="close-video" id="modal-video-hide"></div>
<div class="video-inner">
<div class="video-responsive">
<video class="video" controls webkit-playsinline>
<source src="" type="video/mp4">
</video>
</div>
</div>
</div>
+function($){
var $header = $('.header');
var h = $(window).height();
fixedHeader = function(){
if (
$header.length < 1
) return;
if (
$(window).scrollTop() > 1
) {
$header.addClass('fixed');
} else {
$header.removeClass('fixed');
}
};
var $intro = $('.banner');
if(! $('div').hasClass('slide')){
$('.header').addClass('black');
}
$(document).on('click', '.slider-down-arrow', function(){
$('html, body').animate({ scrollTop: ($intro.next().offset().top - $('#header .navbar').outerHeight()) }, 600);
return false;
});
$(window).scroll(function(){
fixedHeader();
var wst = $(window).scrollTop();
if (
$(window).width() > 768
) {
$intro.css({'margin-top': (0 - Math.floor(wst/5))});
};
});
}(jQuery);
+function($){
var aboutSwiper = new Swiper('.swiper', {
slidesPerView: "1",
centeredSlides: true,
grabCursor: true,
loop: true,
});
var $mvmodal = $('.modal-video');
var $mvideo = $mvmodal.find('.video');
$(".banner .swiper-slide").on('click', function(){
var $slide = $(this),
video_url = $slide.attr('data-video-url');
if(video_url.length!=0){
$("body").addClass("overflow_hidden");
$mvmodal.animate({'top': 0}, 500);
$mvideo.find('source').attr('src', video_url);
$mvideo.get(0).load();
$mvideo.get(0).play();
}
});
$("#modal-video-hide").on('click', function(){
$("body").removeClass("overflow_hidden");
$mvmodal.animate({'top': '110%'}, 500);
if ($mvideo.get(0).paused === false)
$mvideo.get(0).pause();
});
}(jQuery);