Ver Mensaje Individual
  #10 (permalink)  
Antiguo 14/06/2012, 01:50
Avatar de Pentaxeros
Pentaxeros
 
Fecha de Ingreso: mayo-2008
Mensajes: 173
Antigüedad: 16 años
Puntos: 3
Respuesta: llamar a funcion JQuery para reiniciarla para scroll horizontal usando XAJ

Os cuento la solución para que sirva a alguien en el futuro...

Inserte esto en el html:
<div id="botonRESET" class="jTscrollerRESETButton"></div>

Luego en el archivo JS inserte esto:
Código PHP:
$scrollerRESETButton.click(function(e){ 
e.preventDefault();                        $scroller.stop().animate({left:0},options.scrollSpeed,options.scrollEasing);
$scrollerPrevButton.stop().hide("fast");
totalWidth=$scroller.outerWidth(true);
if (
totalWidth>850
{
    
$scrollerNextButton.stop().show("fast");
}
else
{
$scrollerNextButton.stop().hide("fast");
}

}); 
y despues desde XAJAX cada vez que genero el nuevo contenido hago esto:
Código PHP:
 $respuesta4->script("fireEvent(document.getElementById('botonRESET'),'click');"); 
que es esta funcion de javascrip.

Código PHP:
function fireEvent(obj,evt){
    var 
poscicionscroll=window.pageYOffset;
    var 
fireOnThis obj;
    if( 
document.createEvent ) {
      var 
evObj document.createEvent('MouseEvents');
      
evObj.initEventevtfalsefalse ); 
      
fireOnThis.dispatchEvent(evObj);
    } else if( 
document.createEventObject ) {
      
fireOnThis.fireEvent('on'+evt);
    }
        
    } 
y funciona!

Saludos!

Última edición por Pentaxeros; 14/06/2012 a las 02:01