Facebook
From Diego Marques, 3 Years ago, written in JavaScript.
Embed
Download Paste or View Raw
Hits: 136
  1. //PARTE 01
  2. /*
  3. Sintaxe básica do JQuery $(seletor).ação()
  4. $(this).hide(); - ocultar o elemento atual
  5. $("p").hide(); - ocultar o parágrafo
  6. $(".xpto").hide(); - Class
  7. $("#xpto").hide(); - ID
  8. */
  9. $(document).ready(function(){
  10.         $("#TesteX").hide();
  11.         $("#TesteY").hide();
  12.        
  13.         $(".btnApagar").click(function(){
  14.                 $("p").hide();
  15.                 $("h2").hide();
  16.         });
  17.         $(".btnAparecer").click(function(){
  18.                 $("p").show();
  19.                 $("h2").show();
  20.         });
  21.         $("#bird").click(function(){
  22.                 $("#TesteX").show();
  23.                 $("#TesteY").show();
  24.         });
  25.         //
  26.         $("#lista").click(function(){
  27.                 $("ul li:first").hide();
  28.         });
  29.         //
  30.         $("#link").click(function(){
  31.                 $("a[target='_blank']").hide();
  32.         });
  33.        
  34.         //PARTE 02
  35.         //Trabalhando com eventos
  36.         $("#figura").click(function(){
  37.                 $(this).hide(3000);
  38.         });
  39.        
  40.         $("#figura2").dblclick(function(){
  41.                 $(this).hide();
  42.         });
  43.        
  44.         $("#figura3").mouseenter(function(){
  45.                 $(this).hide();
  46.         });
  47.        
  48.         $("#figura4").mouseleave(function(){
  49.                 $(this).hide();
  50.         });
  51.        
  52.         $("#figura5").hover(function(){
  53.                 $(this).hide();
  54.         });
  55.        
  56.         $("input").focus(function(){
  57.                 $(this).css("background-color","red");
  58.         });
  59.        
  60.         $("input").blur(function(){
  61.                 $(this).css("background-color","blue");
  62.         });
  63.        
  64.         $("#titulo1").dblclick(function(){
  65.                 $(this).css("color","red");
  66.                 $(this).css("font-size","30px");
  67.                 $(this).css("text-decoration", "overline");
  68.         });
  69.        
  70.         $("#apagarTempo").click(function(){
  71.                 $("#titulo1").hide(2000);
  72.         });
  73.        
  74.         $("#tPA").hide();
  75.         $("#tH1").click(function(){
  76.                 $("#tPA").toggle(1000);
  77.         });
  78.  
  79. });
  80.  
  81.  
  82.