Guest User

Untitled

a guest
May 23rd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // JavaScript DocumentEste es el código de jQuery a añadir en nuestro documento para que funcione la animación:  
  2.  
  3. $(document).ready(function() {    
  4.     $("#topnav li").prepend("<span></span>");  
  5.      
  6.     //Crear un espacio vacío antes de la etiqueta  COMENTARIO LINEA SIMPLE
  7.  
  8.     $("#topnav li").each(function() {  
  9.  
  10.     //Por cada item  
  11.   var linkText = $(this).find("a").html();  
  12.  
  13.     //Encontrar el texto denteo de la etiqueta <a>  
  14.   $(this).find("span").show().html(linkText);  
  15.  
  16.     //Agregar el texto a la etiqueta span    
  17. });  
  18.  
  19. $("#topnav li").hover(function() {  
  20.  
  21. /*En el hover (cuando el puntero del mouse se posiciona por encima)...  
  22. COMENTARIO MULTI LINEAS
  23. COMENTARIO MULTI LINEAS
  24. COMENTARIO MULTI LINEAS
  25. */
  26.  
  27. $(this).find("span").stop().animate({  
  28.         marginTop: "-40" //Encontrar la etiqueta <span>  y moverla 40 px hacia arriba.  
  29.         }, 250);
  30.                  
  31.     } , function() { //Cuando se quita (retira o mueve) el puntero del mouse...    
  32.         $(this).find("span").stop().animate({    
  33.        
  34.         marginTop: "0"  //Mover la etiqueta <span>devuelta a la posición original (0px)  
  35.     }, 250);  
  36.        
  37.     });    
  38. });
Add Comment
Please, Sign In to add comment