Posted By

kreamweb on 11/22/10


Tagged

jquery tips


Versions (?)

jQuery Events


 / Published in: JavaScript
 

  1. //bind funzione generale degli eventi
  2. $('.box_1').bind('click', function(){
  3. alert("Clicked Box 1");
  4. });
  5. //shortcide
  6. $('.box_2').click(function(){
  7. alert("Clicked Box 2");
  8. });
  9.  
  10. $('.box_3').click(function(){
  11. // this HTML Element
  12. $(this).css('background', '#8C0')
  13. });
  14.  
  15. $('.box_4').bind('dblclick', function(){
  16. $(this).text('Double Clicked');
  17. });
  18.  
  19. $('.box_5').mouseenter(function(){
  20. $(this).css('background', '#C60');
  21. }).mouseleave(function(){
  22. $(this).css('background', '#06C')
  23. })
  24.  
  25. //questa funzione richiede due funzione una per in una per out
  26. $('.box_6').hover(function(){
  27. // In
  28. $(this).text('IN')
  29. }, function(){
  30. // Out
  31. $(this).text('OUT')
  32. })
  33.  

Report this snippet  

You need to login to post a comment.