亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

關于右側樓層導航,到底部距離400px時,自動隱藏。怎么繼續寫這個JavaScript呢?

關于右側樓層導航,到底部距離400px時,自動隱藏。怎么繼續寫這個JavaScript呢?

班大人 2015-10-20 15:30:40
/*監聽滾動條和左側菜單點擊事件?*/ ????????????var?_arr?=?[]; ????????????window.onscroll?=?function(){ ????????????????if(800?<?$(document).scrollTop()){ ????????????????????$('.nav_Sidebar').fadeIn('slow'); ????????????????}else{ ????????????????????$('.nav_Sidebar').fadeOut('slow'); ????????????????} ????????????????scrollBottomTest(); ????????????????$('.home-standard-layout').each(function(index){ ????????????????????var?that?=?$(this); ????????????????????that.index?=?index; ????????????????????if($(document).scrollTop()?+?$(window).height()/2?>?that.offset().top){ ????????????????????????_arr.push(index); ????????????????????} ????????????????});? ????????????????if(_arr.length){ ????????????????????$('.nav_Sidebar?a').eq(_arr[_arr.length-1]).css({'backgroundImage':'url('+SHOP_SITE_URL+'/templates/default/images/home-nav-icon-hover.png)'}).addClass('current').siblings().css({'backgroundImage':'url('+SHOP_SITE_URL+'/templates/default/images/home-nav-icon.png)'}).removeClass('current'); ????????????????????_arr?=?[]; ????????????????} ????????????} ????????????$('.nav_Sidebar?a').each(function(index){ ????????????????$(this).click(function(){ ????????????????????$('html,body').animate({scrollTop:?$('.home-standard-layout').eq(index).offset().top?-?20?+?'px'},?500); ????????????????}).mouseover(function(){ ????????????????????if($(this).hasClass('current')){ ????????????????????????return; ????????????????????}else{ ????????????????????????$(this).css({'backgroundImage':'url('+SHOP_SITE_URL+'/templates/default/images/home-nav-icon-hover2.png)'}); ????????????????????} ????????????????}).mouseout(function(){ ????????????????????if($(this).hasClass('current')){ ????????????????????????return; ????????????????????}else{ ????????????????????????$(this).css({'backgroundImage':'url('+SHOP_SITE_URL+'/templates/default/images/home-nav-icon.png)'}); ????????????????????} ????????????????}); ????????????}); ??????????????/*?距離頂部?樓層消失?*/ ????????????window.onload?=?window.onresize?=?function(){ ????????????????if($(window).width()?<?1300?||?800?>?$(document).scrollTop()){ ????????????????????$('.nav_Sidebar').fadeOut('slow'); ????????????????}else{ ????????????????????$('.nav_Sidebar').fadeIn('slow'); ????????????????} ????????????} /*end*/ //$("#js_banner_top").show(); $("#js_banner_top").slideDown(800); });<div?class="nav_Sidebar"?style="display:?block;"> ????<a?class="nav_Sidebar_1"?href="javascript:;"?style="background-image:?url(????mplates/default/images/home-nav-icon.png);"></a> ????<a?class="nav_Sidebar_2"?href="javascript:;"></a> ????<a?class="nav_Sidebar_3"?href="javascript:;"></a> ????<a?class="nav_Sidebar_4"?href="javascript:;"></a> ????<a?class="nav_Sidebar_5"?href="javascript:;"></a> ????<a?class="nav_Sidebar_6"?href="javascript:;"></a>? ????<a?class="nav_Sidebar_7"?href="javascript:;"></a> ????<a?class="nav_Sidebar_8"?href="javascript:;"></a> </div>.nav_Sidebar?{ ????width:?50px; ????height:?396px; ????position:?fixed; ????bottom:?100px; ????left:?50%; ????margin-left:?-660px; ????display:?none; }頂部的實現了,到底部時,隱藏,我寫了幾次,實現不了,求大神幫助。 ?測試網站?shopnc.96567.com?
查看完整描述

1 回答

已采納
?
躺平的momo

TA貢獻5條經驗 獲得超0個贊

獲取整個頁面的高度減去400,鼠標滑動到這個位置時設置隱藏

查看完整回答
反對 回復 2015-10-20
  • 1 回答
  • 1 關注
  • 1991 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號