// pc banner $("#banner").owlcarousel({ autoplay: true, navigation: false, singleitem: true, stoponhover: true, transitionstyle: 'fadeup', }); // 手机banner $("#bannerm").owlcarousel({ autoplay: true, navigation: false, singleitem: true, stoponhover: true, transitionstyle: 'fadeup', }); $('#us-link').on('click', function(){ $('.left-box').toggleclass('current'); return false; }) $(document).on('click', function(){ if($('.left-box').hasclass('current')){ $('.left-box').removeclass('current'); } }) // 供应信息选项卡 $('.c-tabs span').click(function () { var idx = $(this).index(); $(this).addclass('current').siblings().removeclass('current'); $('.c-con').removeclass('active'); $('.c-con').eq(idx).addclass('active'); }); // 客服组件 $('.m-consultant').each(function () { var self = $(this); var btnopen = self.find('#kfunfold'); var btnclose = self.find('#kfshrink'); var ogroup = self.find('.group'); var owrap = self.find('.wrap'); var owidth = owrap.outerwidth(); btnopen.click(function () { ogroup.hide(); self.animate({ 'right': 0 }, 0) }); btnclose.click(function () { ogroup.fadein(); self.animate({ 'right': -owidth + 'px' }, 0) }); }); // 企业图集放大 $('.atlasimg').click(function () { var ourl = $(this).attr('src'); $('.m-modal').addclass('m-modal-on'); $('#mcpic').attr('src', ourl); }); $('#closebtn, #maskbg').click(function () { $('.m-modal').removeclass('m-modal-on'); }); // 返回顶部 $('.backtop').click(function () { $('html,body').stop(true).animate({ 'scrolltop': 0 }, 600) }); //首页分类切换 $('.nav1 li a').click(function(){ $(this).siblings().slidetoggle(); if ($(this).next().children('li').length==0) { location.href=$(this).attr("href"); } return false; }) //首页滚动切换 $(function(){ var initwidth=0;//滚动宽度 var prevx=0;//起始滚动位置 var leng=0;//总滚动个数 $(".scroll-btn .prev").click(function(){ //initwidth=0; //prevx=0; initwidth=$(".scroll-wrap .product-list:first-child").width(); leng=$(".scroll-wrap").children("ul").length; if(prevx==initwidth*(leng-1)) return false;//判断最大滚动长度 prevx+=initwidth; $(".scroll-wrap .product-list").css("transform","translatex(-"+prevx+"px)"); }); $(".scroll-btn .next").click(function(){ // console.log(prevx); if(prevx==0)return false;//判断滚动的起始位置 initwidth=$(".scroll-wrap .product-list:first-child").width(); prevx-=initwidth; $(".scroll-wrap .product-list").css("transform","translatex(-"+prevx+"px)"); }); }) window.onresize=function(){ $(".scroll-wrap .product-list").css("transform","translatex(0)"); };