Problem with animate(). ¿Why this code isn't working?.
I have the following code in HTML
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <link href="style.css" rel="stylesheet" type="text/css" />
- <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
- <script type="text/javascript" src="js/menu.js"></script>
- <title>Untitled Document</title>
- </head>
- <body>
- <div id="cabezal">
- <div class="contenedorcabezal">
- <div class="logotipo">
- </div>
- <div class="menu">
- <ul>
- <li class="apa"><a href="#">Inicio</a></li>
- <li class="apa"><a href="#">Nosotros</a></li>
- <li class="apa"><a href="#">Modelos</a></li>
- <li class="apa"><a href="#">Servicios</a></li>
- <li class="apa"><a href="#">Contacto</a></li>
- </ul>
- </div><!--Menú-->
- </div><!--Contenedor Cabezal-->
- </div><!--Cabezal-->
- </body>
- </html>
And I'm trying to animate the menu with the following code, but this just doesn't work. So ¿What's the problem here?. Thanks for the help
- $(function () {
- $('.apa').hover(function(){
- $(this).children('a').stop().animate({ 'top': '5px'},100);
- }, function() {
- $(this).children('a').stop().animate({ 'top': '0px'},100);
- });
- });