jquery - Persistent Header for web page -


i have looked @ several jquery methods of making persistent header, don't understand how functions work.

the basis of idea being, have drop down menu somewhere on page , when top of screen gets position, change drop down menu fixed position @ top...

any appreciated.

something this?

http://jsfiddle.net/c5nxh/

html

<div class="test">hello!</div> 

jquery

$( window ).scroll(function() {     offset = $('.test').offset();     if ( offset.top < $( window ).scrolltop() + 10 ){         $('.test').addclass('fixed');     } }); 

css

body{     height: 2000px; }  .test{     position: relative;     top: 100px; }  .test.fixed{     position: fixed;     top: 10px; } 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -