//默认调用的swiper3.4.2 function dufslide_three(option){ dufopt={ wrapperclass:'list', slideclass:'item', bulletclass : 'bul', slideactiveclass : 'act', slidevisibleclass : 'vis', bulletactiveclass : 'act', prevbutton:option.slidewrap+' .prev', nextbutton:option.slidewrap+' .next', pagination :option.slidewrap+' .s-setps', slidenextclass : 's-next', slideprevclass :'s-prev', containermodifierclass :'s-', paginationmodifierclass : 'p-', watchslidesvisibility : true, autoplaydisableoninteraction:false, watchslidesprogress : true, slidetoclickedslide:true, paginationclickable :true, setwrappersize :true, roundlengths : true, autoplay:30000, autoheight: true, loop:true, }; // ie 兼容 assign if (typeof object.assign != 'function') { object.assign = function(target) { 'use strict'; if (target == null) { throw new typeerror('cannot convert undefined or null to object'); } target = object(target); for (var index = 1; index < arguments.length; index++) { var source = arguments[index]; if (source != null) { for (var key in source) { if (object.prototype.hasownproperty.call(source, key)) { target[key] = source[key]; } } } } return target; }; } // 合并参数 option = object.assign(dufopt,option); var myswiper = new swiper(option.slidewrap,option) return myswiper; } //wap 菜单 function wapmenu(){ var screen = $(window).width(); if(screen<1080){ $('.g-header .menu .item').each(function(){ var link = $(this).find('a'); if(link.length>1){ link.eq(0).attr('href','javascript:void(0)'); $(this).addclass('arr') } }) $('.g-header .menu .item').on('click',function(){ $(this).toggleclass('act'); }) $('.g-header .toggle-menu').on('click',function(){ var hasact = $(this).hasclass('act'); $(this).toggleclass('act'); $('.g-header .menu').toggleclass('act') $('.g-header').addclass('fixed'); console.log('hasact',hasact) }) } } function headerfixed(){ var scrolltop = document.documentelement.scrolltop || window.pageyoffset || document.body.scrolltop; var header = $('.g-header'); if(scrolltop>0){ header.addclass('fixed') }else{ header.removeclass('fixed') } //console.log('headerfixed',scrolltop) } function originact(index,idx){ var origflex =$('.origflex').eq(index); origflex.find('.originbar .origin').eq(idx).addclass('act').siblings().removeclass('act') origflex.find('.orightbar .oright').eq(idx).addclass('act').siblings().removeclass('act') } $(function(){ wapmenu() var origflex =$('.origflex'); //console.log('originbar',originbar) if(origflex){ var originbar = $('.originbar'); origflex.each(function(index,item){ originact(index,0); $(item).find('.origin').on('mouseenter ',function(){ let idx = $(this).index(); //console.log('idx',index,idx) originact(index,idx); }) }) } }) $(window).on('scroll',headerfixed) // $(window).resize(function(){ // })