Foros del Web » Programando para Internet » Jquery »

Menu Java Script - Jquery

Estas en el tema de Menu Java Script - Jquery en el foro de Jquery en Foros del Web. Buenas, tengo una simple preguntita: Estoy tratando de hacer un menú con jquery que en el hover se desplace suavemente hacia arriba, entonces bajé un ...
  #1 (permalink)  
Antiguo 22/02/2011, 19:52
Avatar de Jessi11  
Fecha de Ingreso: enero-2011
Mensajes: 29
Antigüedad: 13 años, 3 meses
Puntos: 1
Mensaje Menu Java Script - Jquery

Buenas, tengo una simple preguntita:

Estoy tratando de hacer un menú con jquery que en el hover se desplace suavemente hacia arriba, entonces bajé un código de un menú similar al que quiero, pero éste se desliza hacia la derecha y no hacia arriba como deseo.

Cita:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
<script type='text/javascript'>
$(document).ready(function() {
$('#social_nav_vertical li a').hover(function() {
$(this).stop().animate({ marginLeft: '20px' },300); // on Mouseover move to left
}, function() { //on Mouseout move back to original positon
$(this).stop().animate({ marginLeft: '0px' }, 300);
});

});
</script>

<style type="text/css">

#social_nav_vertical ul {
margin: 0;
padding: 0;
margin-top: 20px;
}
#social_nav_vertical ul li {
padding: 5px 0 0 5px;
margin-left: 5px;
list-style-type: none;
float:left
}

</style>
</head>

<body>

<div id="social_nav_vertical">
<ul>
<li> <a href="">Delicious</a></li>
<li><a href="">Facebook</a></li>
<li><a href=""> Stumble</a></li>
<li><a href="">Twitter</a></li>
</ul>
</div> <!-- end social_nav_vertical -->

</body>
</html>
Bueno, ahí esta el código, que tengo que editar para que en el hover se deslicen hacia arriba?
(No se nada de java script, aunque probé editar donde dice "marginleft" por "marginbottom pero no andubo :P )

Muchas Gracias!

Última edición por Jessi11; 22/02/2011 a las 19:58
  #2 (permalink)  
Antiguo 22/02/2011, 21:06
 
Fecha de Ingreso: enero-2011
Ubicación: Argentina
Mensajes: 80
Antigüedad: 13 años, 3 meses
Puntos: 12
Respuesta: Menu Java Script - Jquery

Mirá este que está muy bueno, usa imagen pero creo que se puede adaptar de forma muy simple para lo que buscas.

Un poco del código del post original
Código Javascript:
Ver original
  1. // Begin jQuery
  2.  
  3. $(document).ready(function() {
  4.  
  5. /* =Reflection Nav
  6. -------------------------------------------------------------------------- */  
  7.  
  8.     // Append span to each LI to add reflection
  9.  
  10.     $("#nav-reflection li").append("");
  11.  
  12.     // Animate buttons, move reflection and fade
  13.  
  14.     $("#nav-reflection a").hover(function() {
  15.         $(this).stop().animate({ marginTop: "-10px" }, 200);
  16.         $(this).parent().find("span").stop().animate({ marginTop: "18px", opacity: 0.25 }, 200);
  17.     },function(){
  18.         $(this).stop().animate({ marginTop: "0px" }, 300);
  19.         $(this).parent().find("span").stop().animate({ marginTop: "1px", opacity: 1 }, 300);
  20.     });
  21.  
  22. /* =Shadow Nav
  23. -------------------------------------------------------------------------- */
  24.  
  25.     // Append shadow image to each LI
  26.  
  27.     $("#nav-shadow li").append('<img class="shadow" src="images/icons-shadow.jpg" alt="" width="81" height="27" />');
  28.  
  29.     // Animate buttons, shrink and fade shadow
  30.  
  31.     $("#nav-shadow li").hover(function() {
  32.         var e = this;
  33.         $(e).find("a").stop().animate({ marginTop: "-14px" }, 250, function() {
  34.             $(e).find("a").animate({ marginTop: "-10px" }, 250);
  35.         });
  36.         $(e).find("img.shadow").stop().animate({ width: "80%", height: "20px", marginLeft: "8px", opacity: 0.25 }, 250);
  37.     },function(){
  38.         var e = this;
  39.         $(e).find("a").stop().animate({ marginTop: "4px" }, 250, function() {
  40.             $(e).find("a").animate({ marginTop: "0px" }, 250);
  41.         });
  42.         $(e).find("img.shadow").stop().animate({ width: "100%", height: "27px", marginLeft: "0px", opacity: 1 }, 250);
  43.     });
  44.  
  45. // End jQuery
  46.  
  47. });

URL del post
http://www.adrianpelletier.com/2009/05/31/create-a-realistic-hover-effect-with-jquery-ui/

Demo
http://adrianpelletier.com/sandbox/jquery_hover_nav/


Ojalá te sea de utilidad. Saludos!

..

Etiquetas: java, javascript
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 01:10.