Ver Mensaje Individual
  #4 (permalink)  
Antiguo 15/09/2008, 10:28
Avatar de marcopoloaz06
marcopoloaz06
 
Fecha de Ingreso: julio-2007
Ubicación: México
Mensajes: 457
Antigüedad: 16 años, 8 meses
Puntos: 11
Respuesta: Jquery y evento toggle()

hola,
de nuevo
ps viéndolo así,
yo todavía sigo con
mi funcion toggleEvent
nada mas que mejorada para
que funcione con cualquier evento
Código HTML:
$.fn.toggleEvent = function( e, fn ) {
	var args = arguments, i = 2;
	while( i < args.length )
		jQuery.event.proxy( fn, args[i++] );
    
	return this[e]( jQuery.event.proxy( fn, function(event) {
		this.lastToggle = ( this.lastToggle || 1 ) % i == 0 ? 1 : ( this.lastToggle || 1 ) % i;
		event.preventDefault();
		return args[ this.lastToggle++ ].apply( this, arguments ) || false;
	}));
};
ejemplo:
Código HTML:
    $("html").toggleEvent("keydown",
            function(){
                alert("1");
            },function(){
                alert("2");
            },function(){
                alert("3");
            },function(){
                alert("4");
            },function(){
                alert("5");
            }
    );
PD. Ya no hace onclick ni tampoco tiene eval
camarax
;]
__________________
Aerolíneas Alicia :D