实现侧边导航栏的悬浮设置


首先看效果图:

最开始鼠标没有滚动的时候:

 

 当鼠标滚动下拉到一定高度的时候:

 

 侧边的悬浮框会一直悬浮在最左边,实现导航的悬浮。

通过js代码实现:

 

 js代码:

var n_t1 = $('body').height() * 0.12;
            if(scrTop < n_t1){
              $('.content2_left').css("position","absolute")
              $('.content2_left').css("left","0px")
              $('.content2_left').css("top","0px")
            }else{
                $('.content2_left').show()
                // $('.content2_left').css("background-color","red")
                $('.content2_left').css("position","fixed")
                $('.content2_left').css("left","10%")
                $('.content2_left').css("top","5%")

            }

  

 

 

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM