Demo entry 6635979

code

   

Submitted by anonymous on Aug 22, 2017 at 10:56
Language: JavaScript. Code size: 359 Bytes.

<script type="text/javascript">
$(function(){
var nav=$(".header"); //得到导航对象
var win=$(window); //得到窗口对象
var sc=$(document);//得到document文档对象。
win.scroll(function(){
  if(sc.scrollTop()>=160){
    nav.addClass("fixednav"); 
   $(".navTemp").slideDown(); 
  }else{
   nav.removeClass("fixednav");
   $(".navTemp").slideUp();
  }
})  
})
</script>

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).