Guest User

Untitled

a guest
Jul 17th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. <script>
  2.  
  3. var active_page_id = 4;
  4.  
  5. function getPosition(id)
  6. {
  7. switch(id)
  8. {
  9. case 1:
  10. return position = "321px";
  11. break;
  12. case 2:
  13. return position = "407px";
  14. break;
  15. case 3:
  16. return position = "496px";
  17. break;
  18. case 4:
  19. return position = "556px";
  20. break;
  21. case 5:
  22. return position = "619px";
  23. break;
  24. default:
  25. //
  26. }
  27. }
  28.  
  29. function slideOver(id)
  30. {
  31. $("#top_menu_arrow").stop().animate({
  32. left: getPosition(id)
  33. }, 700);
  34. }
  35.  
  36. function slideBack()
  37. {
  38. $("#top_menu_arrow").stop().animate({
  39. left: getPosition(active_page_id)
  40. }, 700);
  41. }
  42.  
  43. $(document).ready(function() {
  44. // initiate active section in menu
  45. slideOver(active_page_id);
  46. });
  47.  
  48. </script>
  49.  
  50. usage:
  51. <a href="#" onMouseOver="slideOver(5)" onMouseOut="slideBack()" />
Add Comment
Please, Sign In to add comment