Skip to main content
Oct 11, 2019 12:08 PM UTC
Question

Cambiar posición de un objeto con javascript

Hola:

 

Estoy intentando cambiar la posición y tamaño de un Smart Shape a través de Javascript. Consigo hacerlo a través de un botón pero necesitaría conseguirlo en el evento "Al Entrar" de la diapositiva y no funciona.

El código que utilizo es:

 

var obj = document.getElementById( "SmartShape_105c" );
obj.style.width = (420 ) + "px";

    This topic is closed to new replies. Start a new post to keep the conversation going.

    3 replies

    chrismay_at_delta17095116
    Inspiring
    Oct 11, 2019 3:48 PM UTC

    Anyway I find that Captivate is still manipulating smartshapes when it hits the OnEnter action. You need to create an interval and constantly loop through it until Captivate is finished and then your code will execute and "stick".

     

     

     

    var myInterval = setInterval(checkSize,100);
    function checkSize(){
       if(SmartShape_105c.style.width=="420px"){
         clearInterval(myInterval);
       }else{
         SmartShape_105c.style.width="420px";
       }
    }

     

     

    Translate
    chrismay_at_delta17095116
    Inspiring
    Oct 11, 2019 3:13 PM UTC

    obj.style.width = "420px";

    Translate
    chrismay_at_delta17095116
    Inspiring
    Oct 11, 2019 3:43 PM UTC

    oops I hit reply by accident when trying to add my reply... cannot hit the return key without submitting...

     

     

     

     

    Translate