jQuery Functions


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



Copy this code and paste it in your HTML
  1.  
  2.  
  3.  
  4. click
  5. ----------------------
  6.  
  7. $('#target').click(function() {
  8. alert('Handler for .click() called.');
  9. });
  10.  
  11.  
  12. hover
  13. ----------------------
  14.  
  15. $("li").hover(
  16. function () {
  17. $(this).append($("<span> ***</span>"));
  18. },
  19. function () {
  20. $(this).find("span:last").remove();
  21. }
  22. );
  23.  
  24.  
  25. animate
  26. ----------------------
  27.  
  28. $('#clickme').click(function() {
  29. $('#book').animate({
  30. opacity: 0.25,
  31. left: '+=50',
  32. height: 'toggle'
  33. }, 5000, function() {
  34. // Animation complete.
  35. });
  36. });
  37.  
  38. $('img.selector_tab').animate({ marginLeft: 225 }, 350, function() {
  39. // Callback
  40. $('.opt.existing').css('color', '#a60e00');
  41. });
  42.  
  43.  
  44. Animate margin top on hover
  45.  
  46. $('.footerRibbon').hover(
  47. function() {
  48. $('.footerBook').animate({ marginTop: '-220px' }, 250, "swing" );
  49. }, function() {
  50. $('.footerBook').animate({ marginTop: '-170px' }, 250, "swing" );
  51. });
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.