/* ---------------------------------------------------------------- modify : 网页通用jq,js效果 created on : 2019-4-14, 15:07:00 author : snake -----------------------------------------------------------------*/ // 全部效果集合 function run() { // 幻灯片图片数量大于1的情况下才展示左右箭头 $('.carousel-item').each(function () { var caritem = $(this).find('.carousel-inner .item').length; if( caritem >= 2 ){ $(this).find('.carousel-indicators li').eq(0).addclass('active'); } else if( caritem == 1 ){ $(this).find('.carousel-indicators li').remove(); $(this).find('a.carousel-control').remove(); } else { $(this).find('.carousel-indicators li').remove(); $(this).find('a.carousel-control').remove(); $('.indexbody').css('margin-top','180px'); } }); // 获取浏览器可视图高度赋值在幻灯片图片高度 var browserheight = $(window).height(); $('.fullpage-slide .slide').each(function () { $(this).find('img.img-responsive').css('height',browserheight); }); // 导航菜单子类少于父类自动适配宽度 $('.dropdown .dropdown-menu').each(function(){ // 获取导航菜单子类宽度 var navwdith = $(this).parent('.dropdown').width(); // 获取导航菜单夫类宽度 var narpwdith = $(this).width(); // 如果子类宽度少于父类宽度,自动适配父类宽度 if( navwdith > narpwdith ) { $(this).css('min-width',navwdith); } else { return true; } }); } //当窗口改变宽度时执行此函数 window.onresize = resizebannerimage; //电脑版右侧按钮跳转效果,滚动效果 function resizebannerimage() { $('#dowebok').fullpage({ 'verticalcentered': false, 'sectionscolor': ['#0f87cf', '#0c6fc3', '#7baabe', '#0c6fc3', '#0c6fc3', '#0c6fc3', '#085ca2'], 'anchors': ['page1', 'page2', 'page3', 'page4', 'page5', 'page6', 'page7'], 'css3': true, 'scrollingspeed': 700, 'navigation': true, 'navigationposition': 'right', 'navigationtooltips': ['首页', '产品中心', '关于恒洲', '工厂实景', '新闻中心', '我们优势', '合作伙伴'] }); var winw = $(window).width(); if (winw > 1200) { $.fn.fullpage.setautoscrolling(true); setinterval(function() { $.fn.fullpage.moveslideright(); }, 3000); } else { $.fn.fullpage.setautoscrolling(false); } } // 幻灯片( pc,手机 ) function windowwidth(){ // 获取当前浏览器宽度 var windowwidth = $(window).width(); $('.carousel-item .carousel-indicators li').each(function () { // 获取title值 var indicatorstitle= $(this).attr('title'); // 判断当前浏览器宽度 if( windowwidth >= 1200 ) { if( indicatorstitle == 'index' ) { return true; } else { $(this).remove(); } } else if( windowwidth <= 1199 ) { if( indicatorstitle == 'mobile' ) { return true; } else { $(this).remove(); } } // 给第一个加一个class名字 active $('.carousel-item .carousel-indicators').find('li:first').addclass('active'); }); $('.carousel-item .carousel-inner .item').each(function () { // 获取title值 var innertitle = $(this).attr('title'); // 判断当前浏览器宽度 if( windowwidth >= 1200 ) { if( innertitle == 'index' ) { return true; } else { $(this).remove(); } } else if( windowwidth <= 1199 ) { if( innertitle == 'mobile' ) { return true; } else { $(this).remove(); } } // 给第一个加一个class名字 active $('.carousel-item .carousel-inner').find('.item:first').addclass('active'); }); } // 动画效果 function wows(){ var wow = new wow({ boxclass: 'wow', animateclass: 'animated', offset: 0, mobile: true, live: true }); wow.init(); }