$(function(){ // 屏幕滚动 $(window).scroll(function (){ var str = $(this).scrollTop(); navigation(str); }); }) /* * 获取 DOC 超出可视区域的高度 */ var dir = $(document).scrollTop(); navigation(dir); function navigation(st){ if(st >180){ $('.m_top').css('background','rgba(255,255,255,1)'); $('.m_top a.m_be').find('img').attr('src','/image/back_1.png'); $('.m_top a.menu').find('img').attr('src','/image/menu_a_1.png'); $('.m_top .m_title').show(); }else if(st>80 && st <= 180){ $('.m_top a.m_be').find('img').attr('src','/image/back_1.png'); $('.m_top a.menu').find('img').attr('src','/image/menu_a_1.png'); $('.m_top').css('background','rgba(255,255,255,0.8)'); $('.m_top .m_title').show(); }else{ $('.m_top').css('background','rgba(255,255,255,0)'); $('.m_top a.m_be').find('img').attr('src','/image/lp_index/back.png'); $('.m_top a.menu').find('img').attr('src','/image/index/menu_a.png'); $('.m_top .m_title').hide(); } // 显示 与 隐藏 二级导航 if(st > 180){ $('.w_find_nav').fadeIn(); }else{ $('.w_find_nav').fadeOut(); } }