$(function(){ var swiper = new Swiper('.top-container', { slidesPerView: 1, loop: true, speed: 1000, //centeredSlides:true, //pagination: { //el: '.swiper-pagination', // clickable: true, // }, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, autoplay: { delay: 8000, disableOnInteraction: false, }, // breakpoints: { // 1367: { // slidesPerView: 3, // }, //} }); setsize_top(); setscroll(); }); $(window).on('load',function(){ setsize_top(); setscroll(); }); $(window).on('resize',function () { setsize_top(); setscroll(); }); $(window).on('orientationchange', function(){ setsize_top(); setscroll(); }); function setsize_top(){ var msize = $("#mainimg").outerHeight(); var hsize2 = $("#head").outerHeight(); $("#main").css("padding-top",msize+"px"); $("#mainimg").css("top",hsize2+"px"); } $(window).on('scroll',function () { setscroll(); }); function setscroll(){ var mg = 5; if($(window).width() > 640){ mg=1; } var scl = $('body').scrollTop(); if(scl==0){scl = $('html').scrollTop();} var mrg = $("#head").outerHeight(); if(scl > mg && !$('#mainimg').hasClass('off')){ $('#mainimg').addClass('off') } if(scl <= mg && $('#mainimg').hasClass('off')){ $('#mainimg').removeClass('off') } }