Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/07/2010, 15:41
Avatar de AlZuwaga
AlZuwaga
Colaborador
 
Fecha de Ingreso: febrero-2001
Ubicación: 34.517 S, 58.500 O
Mensajes: 14.550
Antigüedad: 23 años, 2 meses
Puntos: 535
Dejar sin efecto una función mediante otra

Hola. Me explico. Tengo un slider de noticias que se activa con:

Código Javascript:
Ver original
  1. <script type="text/javascript">
  2.    
  3.         function formatText(index, panel) {
  4.           return index + "";
  5.         }
  6.    
  7.         $(function () {
  8.        
  9.             $('.anythingSlider').anythingSlider({
  10.                 easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
  11.                 autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
  12.                 delay: 3000,                    // How long between slide transitions in AutoPlay mode
  13.                 startStopped: false,            // If autoPlay is on, this can force it to start stopped
  14.                 animationTime: 600,             // How long the slide transition takes
  15.                 hashTags: true,                 // Should links change the hashtag in the URL?
  16.                 buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
  17.                 pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
  18.                 startText: "Go",             // Start text
  19.                 stopText: "Stop",               // Stop text
  20.                 navigationFormatter: formatText       // Details at the top of the file on this use (advanced use)
  21.             });
  22.            
  23.             $("#slide-jump").click(function(){
  24.                 $('.anythingSlider').anythingSlider(6);
  25.             });
  26.            
  27.         });
  28.     </script>


Ahora, resulta que quiero dejar ese slider sin efecto mediante un función llamada slider_lista(elemento)

Código Javascript:
Ver original
  1. <script type="text/javascript">
  2.     function slider_lista(elemento){
  3. /*      <div class="anythingSlider" id="slider">*/
  4.         var elemento = document.getElementById(elemento.id);
  5.         if(elemento.textContent == "Ordenar"){
  6.             elemento.textContent = "Rotar"
  7.             document.getElementById('slider').className = "anythingSliderOrden";
  8.         }
  9.         else{
  10.             elemento.textContent = "Ordenar"
  11.             document.getElementById('slider').className = "anythingSlider";
  12.         }
  13.     }
  14.     </script>
  15.  
  16.  
  17. <div id="slider_lista" onclick="slider_lista(this)">Ordenar</div>

Lo que hace esa función básicamente es reemplazar la clase anythingSlider por otra (anythingSliderOrden) al div #slider peeeeero... si bien el slider deja de funcionar, me siguen apareciendo "cosas" creadas por la ejecución original de $('.anythingSlider').anythingSlider(...). Cosas como por ejemplo que los enlaces de navegación siguen apareciendo y me agrega <li> de más (el primero lo duplica al final y el último al inicio). Lo que me gustaría es que esa función hiciera de cuenta que jamás se hubiera llamado a la primera (y que al volver a hacer click vuelva todo a la normalidad)

El motivo de todo esto es poder "desactivar" el slider para poder ordenar sus contenidos "visualmente" mediante "jquery.ui.sortable.js".

Me explico? Se puede?
Gracias!
__________________
...___...