<div class="banner_swiper" {{ app('visual').url('section', 16079) }}>
<div class="swiper-wrapper">
{% ...
<div class="banner_swiper" {{ app('visual').url('section', 16079) }}>
<div class="swiper-wrapper">
{% for value in app('section').id(16079) %}
<div class="swiper-slide">
<a href="{{ value.url }}">
{% if value.video !='' %}
<video class="myVideo" src="{{ value.video | videos_url }}" width="100%" height="100%" controls autoplay loop muted></video>
{% else %}
<img src="{{ value.img | img_format }}" alt="{{ value.name }}" />
{% endif %}
</a>
</div>
{% endfor %}
</div>
<div class="swiper-pagination"></div>
</div>
// fullpage
$('#fullpage').fullpage({
anchors: ['Page1', 'Page2', 'Page3', 'Page4', 'Page5', 'Page6', 'Page7', 'Page8'],
css3: true,
scrollingSpeed: 1000,
responsiveWidth: 1025,
keyboardScrolling: true,
navigation: true,
afterLoad: function(anchorLink, index) {
if (index.index == 3) {
$('.counter').countUp();
}else if (index.index == 4){
$('.counter').countUp();
}
},
onLeave: function(anchorLink, index, direction){
if (index.index == 1) {
var videos = document.getElementsByClassName('myVideo');
for (var i = 0; i < videos.length; i++) {
videos[i].pause(); // 在离开第一屏时暂停所有视频播放
}
} else {
var videos = document.getElementsByClassName('myVideo');
for (var i = 0; i < videos.length; i++) {
videos[i].play(); // 在回到第一屏时播放所有视频
}
}
}
});