some jQuery samples -- back to top / fadein fadeout menu / drupal menu open new window


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // back to top button
  2. $(function() {
  3. $('#back_to_top').click(function() {
  4. $('body,html').animate({scrollTop:0},800);
  5. });
  6. });
  7.  
  8. //menu fadein/fadeout anmiation.
  9. $(function() {
  10. $('ul li ul', this).hide();
  11. var enterEvent = function() {
  12. $('ul', this).fadeIn();
  13. };
  14. var leaveEvent = function() {
  15. $('ul', this).hide();
  16. };
  17. $('#nav ul li').hover(enterEvent, leaveEvent);
  18. });
  19.  
  20. // gallery menu open a new window
  21. $(document).ready(function(){
  22. $("#nav li.last").click(function(){
  23. window.open('http://www.steveparishgallery.com');
  24. return false;
  25. });
  26. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.