$(function () { var swiperbanner= new swiper('.index-banner-swi .swiper-container', { pagination: '.index-banner-swi .swiper-pagination', paginationclickable: '.index-banner-swi .swiper-pagination', nextbutton: '.index-banner-swi .swiper-button-next', prevbutton: '.index-banner-swi .swiper-button-prev', autoplay: 3000, autoplaydisableoninteraction: false, effect: 'effect' }); var swiarrc=[]; $(".index-work .tabcons .tabcon").each(function(){ swiarrc[$(this).index()] = new swiper($(this).find(".swiper-container"), { pagination: '.caseswi'+($(this).index()+1)+' .swiper-pagination', paginationclickable: '.caseswi'+($(this).index()+1)+' .swiper-pagination', observer:true, observeparents:true, slidesperview: 4, spacebetween: 26, breakpoints: { 1000: { slidesperview: 2, spacebetween: 30 }, 768: { slidesperview: 2, spacebetween: 10 }, 640: { slidesperview: 1, spacebetween: 0 } }, effect: 'effect' }); }); var initswi = $(".videocateswi .swiitem.active").parent(".swiper-slide").index(); var videocateswi= new swiper('.videocateswi .swiper-container', { nextbutton: '.videocateswi .swiper-button-next', prevbutton: '.videocateswi .swiper-button-prev', initialslide :initswi, slidesperview: 4, effect: 'effect', spacebetween: 20, breakpoints: { 1000: { slidesperview: 3 }, 768: { slidesperview: 2 }, 640: { slidesperview: 1, spacebetween: 0 } }, }); var swiarr=[]; $(".hsh .switems1 .item").each(function(){ swiarr[$(this).index()] = new swiper($(this).find(".swiper-container"), { nextbutton: '.switems1 .hshswi'+$(this).index()+' .swiper-button-next', prevbutton: '.switems1 .hshswi'+$(this).index()+' .swiper-button-prev', observer:true, observeparents:true, slidesperview: 4, spacebetween: 2, breakpoints: { 1250: { slidesperview: 3 }, 1000: { slidesperview: 3 }, 768: { slidesperview: 2 }, 640: { slidesperview: 1 } }, effect: 'effect' }); }); var swiarr2=[]; $(".hsh .switems2 .item").each(function(){ swiarr2[$(this).index()] = new swiper($(this).find(".swiper-container"), { nextbutton: '.switems2 .hshswi'+$(this).index()+' .swiper-button-next', prevbutton: '.switems2 .hshswi'+$(this).index()+' .swiper-button-prev', observer:true, observeparents:true, slidesperview: 4, spacebetween: 2, breakpoints: { 1250: { slidesperview: 3 }, 1000: { slidesperview: 2 }, 768: { slidesperview: 2 }, 640: { slidesperview: 1 } }, effect: 'effect' }); }); var newsswi= new swiper('.newsswi .swiper-container', { nextbutton: '.newsswi .swiper-button-next', prevbutton: '.newsswi .swiper-button-prev', slidesperview: 3, effect: 'effect', spacebetween: 42, breakpoints:{ 1000:{ spacebetween: 20 }, 768: { slidesperview: 2 }, 640: { slidesperview: 2, spacebetween: 10 } }, }); var picswi= new swiper('.picswi .swiper-container', { pagination: '.picswi .swiper-pagination', paginationclickable: '.picswi .swiper-pagination', nextbutton: '.picswi .swiper-button-next', prevbutton: '.picswi .swiper-button-prev', effect: 'effect' }); $(".preview .swiper-slide").eq(0).addclass("active-nav"); var viewswiper = new swiper('.view .swiper-container', { onslidechangestart: function() { updatenavposition() } }) $('.view .arrow-left,.preview .arrow-left').on('click', function(e) { e.preventdefault() if (viewswiper.activeindex == 0) { viewswiper.slideto(viewswiper.slides.length - 1, 1000); return } viewswiper.slideprev() }) $('.view .arrow-right,.preview .arrow-right').on('click', function(e) { e.preventdefault() if (viewswiper.activeindex == viewswiper.slides.length - 1) { viewswiper.slideto(0, 1000); return } viewswiper.slidenext() }) var previewswiper = new swiper('.preview .swiper-container', { //visibilityfullfit: true, slidesperview: 'auto', allowtouchmove: false, ontap: function() { viewswiper.slideto(previewswiper.clickedindex) } }) function updatenavposition() { $('.preview .active-nav').removeclass('active-nav') var activenav = $('.preview .swiper-slide').eq(viewswiper.activeindex).addclass('active-nav') if (!activenav.hasclass('swiper-slide-visible')) { if (activenav.index() > previewswiper.activeindex) { var thumbspernav = math.floor(previewswiper.width / activenav.width()) - 1 previewswiper.slideto(activenav.index() - thumbspernav) } else { previewswiper.slideto(activenav.index()) } } var mediavideo=document.getelementsbyclassname("videobox"); for(var i=0;i1000){ $(".index-book .booklist .book").eq(0).addclass("active").removeclass("noac").siblings().addclass("noac").removeclass("active"); $(".index-book .booklist .book").hover(function(){ $(this).addclass("active").removeclass("noac").siblings().addclass("noac").removeclass("active"); },function(){ // $(".index-book .booklist .book").removeclass("noac").removeclass("active"); }) } $(".sitelist").click(function(){ $(this).find(".slidesite").stop().slidetoggle(); }); $(".map .mask").click(function(){ $(this).hide(); }) //mobile var navopen=false; $(".menu").click(function(){ if(navopen){ $("#menu-handler").removeclass("active"); navopen=!navopen; $(".btheader").removeclass("slide"); } else{ $("#menu-handler").addclass("active"); navopen=!navopen; $(".btheader").addclass("slide"); } $(".mheader .navmo").stop().slidetoggle(); }); $(".mheader .navmo .nav1").click(function(){ $(".nav2list").stop().slideup(); $(this).find(".nav2list").stop().slidetoggle(); }) start(); //topback $("#backtop").click(function(){ $('html , body').animate({scrolltop: 0},'slow'); }); $(window).on('scroll', function() { start(); var j = document.documentelement.scrolltop || document.body.scrolltop; if (j > 0) { $("#backtop").show(); } else { $("#backtop").hide(); } }) function start() { //.not('[data-isloaded]')选中已加载的图片不需要重新加载 $('img').not('[data-isloaded]').each(function() { var $node = $(this) if(isshow($node)) { loadimg($node) } }) } //判断一个元素是不是出现在窗口(视野) function isshow($node) { return $node.offset().top <= $(window).height() + $(window).scrolltop() } //加载图片 function loadimg($img) { //.attr(值) //.attr(属性名称,值) $img.attr('src', $img.attr('data-src')) //把data-src的值 赋值给src $img.attr('data-isloaded', 1) //已加载的图片做标记 } function tabchange(tab,con,ac){ $(tab).click(function(){ var i=$(this).index(); $(this).addclass(ac).siblings().removeclass(ac); $(con).eq(i).addclass(ac).siblings().removeclass(ac); }); } $(".tabbars .tabbar").eq(0).addclass("active"); $(".tabcons .tabcon").eq(0).addclass("active"); tabchange(".tabbars .tabbar",".tabcons .tabcon","active"); // pubuliu //监听滚动条 waterfall(); var dr_page = 1; $("#waterload").click(function(){ addwaterfall();//动态填充新展示框 }); //数据填充 function addwaterfall(){ //新的数据 dr_page++; // 加载下一页的意思 $.get('/index.php?s='+$('#waterload').data('module')+'&c=api&m=template&name=list_story.html&catid='+$('#waterload').data('category')+'&page='+dr_page+'&keyword='+$(" input[ name='keyword' ] ").val(), function (html) { $('#waterfall').append(html); // 将返回的内容追加到内容区域$('#waterload').data('site') waterfall(); }); // var data = // [{"img":'img/book1.jpg',"title":'一切为了销售',"enkind":'hero of bontop',"chkind":'邦泰英雄',"profile":"时值《复仇者联盟4:终局之战》正火热上映中,一票难求,盛况空前。而在乐山嘉州长卷·天玺小区却真实上演了一场惊险万分的“追逐战”。","see":'123',"dianzan":'456',"time":'2019-04-26'}, // {"img":'img/pic.jpg',"title":'工作创造价值',"enkind":'hero of bontop',"chkind":'邦泰英雄',"profile":"时值《复仇者联盟4:终局之战》正火热上映中,一票难求,盛况空前。而在乐山嘉州长卷·天玺小区却真实上演了一场惊险万分的“追逐战”。","see":'123',"dianzan":'456',"time":'2019-04-26'}, // {"img":'img/poster.jpg',"title":'忠城卫士 退伍不退色',"enkind":'hero of bontop',"chkind":'邦泰英雄',"profile":"时值《复仇者联盟4:终局之战》正火热上映中,一票难求,盛况空前。而在乐山嘉州长卷·天玺小区却真实上演了一场惊险万分的“追逐战”。","see":'123',"dianzan":'456',"time":'2019-04-26'}]; // var html=''; // var len=data.length // for(var i=0;i'+ // '

'+data[i].enkind+'.

'+ // '

'+data[i].chkind+'

'+ // '

'+data[i].time+'

'+ // '
'+ // '
'+ // '

'+data[i].dianzan+'

'+ // '
'+ // ''+ // '
'+ // ''+ // ''+ // '
'+ // '
'+ // '
'+ // '
'+data[i].title+'
'+ // '
'+data[i].profile+'
'+ // '
'+ // '
'+data[i].see+'浏览
'+ // 'continue reading'+ // '
'+ // '
'+ // '
'+ // ''; // }; // $("#waterfall").append(html); } //判断是否需要继续加载瀑布流 function checkscrollside(){ //拿到最后一个盒子 var $lastbox = $('#waterfall>.wateritem').last(); //最后一个盒子的头部偏移 var lastboxdis = $lastbox.offset().top + math.floor($lastbox.outerheight()/2); var scrolltop = $(window).scrolltop(); var documenth = $(window).height(); return (lastboxdis.wateritem" ); // 一个块框的宽 var w = $boxs.eq(0).outerwidth(); //每行中能容纳的展示框个数 var cols = math.floor( $( "#waterfall" ).width() / w ); //最外围居中 $('#waterfall').width(w*cols).css('margin','o auto'); //用于存储 每列盒子的高度 var harr=[]; $boxs.each( function( index, value ){ //取出单个盒子的高度 var h = $boxs.eq(index).outerheight(); if( index < cols ){//拿到第一行盒子 harr[ index ] = h; }else{ //其他盒子 //数组harr中的最小值minh,就是最矮的那个 var minh = math.min.apply( null, harr ); //最矮的脚标 var minhindex = $.inarray( minh, harr ); //定位 $(value).css({ 'position':'absolute','top':minh+'px', 'left':minhindex*w + 'px' }); //数组 最小高元素的高 + 添加上的展示框[i]块框高 harr[ minhindex ] += $boxs.eq( index).outerheight();//更新添加了块框后的列高 } }); var maxh = math.max.apply({},harr)+10; $('#waterfall').css('height',maxh) }