Advertisement
hogash

chaser

May 20th, 2012
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. $(function ($) {
  2. //////////////////////////////////////////////////////////////////////////
  3. ////// START - CODE FOR LOADING THE TOP MENU CHASING BAR
  4. //////////////////////////////////////////////////////////////////////////
  5.  
  6. var doc = $(document), win = $(window), chaser, forch,
  7. forchBottom, visible;
  8. function shown() {
  9. visible = true;
  10. }
  11. function hidden() {
  12. visible = false;
  13. }
  14. chaser = $('#rt-header ul.menu').clone().hide().appendTo(document.body).wrap("<div class='chaser'></div>");
  15. forch = $('.forchaser').first();
  16. forchBottom = forch.height() + forch.offset().top;
  17. hidden();
  18. win.bind('scroll', function () {
  19. var top = doc.scrollTop();
  20. if (!visible && top > forchBottom) {
  21. chaser.slideDown(300, shown);
  22. } else if (visible && top < forchBottom) {
  23. chaser.slideUp(200, hidden);
  24. }
  25. });
  26.  
  27.  
  28. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement