Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/09/2012, 10:22
reinerel
 
Fecha de Ingreso: septiembre-2012
Ubicación: Lima
Mensajes: 4
Antigüedad: 11 años, 7 meses
Puntos: 1
Pregunta Llamar a funcion jquery desde etiqueta

Hola!... quisiera me ayuden con este script:

-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------

<html>
<head>
<style>
*{font-family:sans-serif;}
button{padding:10px 20px;font-size:14px;position:relative;}
</style>

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script>

$(document).ready(function () {

$('#ejemplo').toggle(function () {

$(this).animate({left:'200px'}, 300)

}, function () {

$(this).animate({left:'0px'}, 300)

});

});
</script>

<button id="ejemplo">Hola</button>
</body>
</html>

-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------


Como ya sabran, el efecto TOGGLE se usa para mover animadamente un boton de izquierda a derecha, arriba y abajo.

Para que funcione solo basta con agregar un boton con el id "ejemplo"

Mi gran duda es como llamar a esa funcion desde una etiqueta <a> es decir desde un vinculo porque no quiero usar un boton para llamar a esa funcion.

Agradezco mucho su ayuda!...