/ Published in: HTML
Expand |
Embed | Plain Text
<style> #sticky { width: 600px; } #sticky.stick { position: fixed; top: 0; z-index: 10000; } </style> <script type="text/javascript"> function sticky_relocate() { var window_top = $(window).scrollTop(); var div_top = $('#sticky-anchor').offset().top; if (window_top > div_top) $('#sticky').addClass('stick') else $('#sticky').removeClass('stick'); } // If you have jQuery directly, use the following line, instead // $(function() { // If you have jQuery via Google AJAX Libraries google.setOnLoadCallback(function() { $(window).scroll(sticky_relocate); sticky_relocate(); }); </script>
You need to login to post a comment.
