$(function() { //检查对象,#placeholder是要随滚动条固定的ID var $offset = $('.placeholder').offset(); // console.log($eleHeight) // console.log($offset.top); $(window).scroll(function () { //检查对象的顶部是否在游览器可见的范围内 var scrollTop = $(window).scrollTop(); // if ( (offset.top ) 0) { //$('.nav-wrap').addClass('nav-toggle-scroll'); //$('#imgLogo').attr('src','public/images/logo_black.png'); //} //else { // $('.nav-wrap').removeClass('nav-toggle-scroll'); // $('#imgLogo').attr('src','public/images/logo_white.png'); //} //关于我们导航的滚动,样式,offset()方法返回或设置匹配元素相对于文档的偏移(位置) var eleHeight = $('.about-us-banner-other').offset(); var scrollHeight = $(window).scrollTop(); if (scrollHeight >100) { $('.about-us-nav').css({ 'position':'fixed', 'top':'10px', 'left':'0', 'right':'0', 'margin':'0 auto', 'z-index':'999', 'width':'inherit' }) } else { $('.about-us-nav').removeAttr('style'); } }); $("#owl-testimonial").owlCarousel({ autoPlay: 6000, items : 1, itemsDesktop : [1199,1], itemsDesktopSmall : [979,1], itemsTablet: [768,1], itemsTabletSmall: false, itemsMobile : [479,1], }); //首页客户说 $('#horizontalTab').easyResponsiveTabs({ type: 'default', width: 'auto', fit: true }); // 导航条选中样式 $('.navbar-right-select li a').each(function(){ if($($(this))[0].href==String(window.location)) { console.log("点击了") $(this).parent().addClass('selected'); } }); //关于我们 锚点 $(".nav-select > li > a").click(function(){ $(this).addClass("selected").parents().siblings().find("a").removeClass("selected"); }) //回到顶部 $('#scrollTop').click(function(){ $("html,body").animate({scrollTop:0},600); }) //关于我们导航栏对应点击栏目的滚动 $('#nav-aboutus li').find("a").each(function(i){ $(this).click(function(){ $("html,body").animate({scrollTop:$('#jq_'+ i).offset().top + 20},600); }) }) $('.about-us-nav').navScroll({ mobileDropdown: true, mobileBreakpoint: 768, scrollSpy: true }); //案例导航 $('#nav-example li').find("a").each(function(i){ $(this).click(function(){ $("html,body").animate({scrollTop:$('#jq-'+i).offset().top -30},600); }) }) //服务导航 $('#nav-customer li').find("a").each(function(i){ $(this).click(function(){ $("html,body").animate({scrollTop:$('#jq_'+i).offset().top -30},600); }) }) //资质证书 $('#demo1').flexImages({rowHeight: 200}); });