2 Replies Latest reply on Jan 8, 2013 11:05 AM by jdhughen

    call jquery function from within an edge animation?

    jdhughen Level 1

      All,

       

      Can you call a jquery function from a edge animation ? for example can I call this function using a onclick trigger in my animation:

       

      in edge animation....

      $('html,body').animate({ scrollTop: $("#edgeWrapper").offset().top }, 1000);

      sym.play(start);

       

      where in page html

       

      <div id="edgeWrapper">

      <div id="stage" class="Edge_Animation">

      </div>

      </div>

       

      so that the page would scroll to my animation before it plays ?????

       

      also...

       

      Can a edge animation access javascript global vars declared in a webpage <script> tag ?

       

      Thanks

       

      Joel H

        • 1. Re: call jquery function from within an edge animation?
          joel_pau Level 5

          Hi,

           

          I just check it. #edgeWrapper will be found by jQuery using Edge.

          But, you could add a complete function to animate: jQuery help.

          .animate({ scrollTop: $("#edgeWrapper").offset().top }, 1000, function(){sym.play(start);});

          • 2. Re: call jquery function from within an edge animation?
            jdhughen Level 1

            Joel,

             

            thanks for the reply.

             

            I got this to work (I had forgot to put the " " around "start" the play function.

             

            $('html,body').animate({ scrollTop: $("#edgeWrapper").offset().top }, 1000);

            sym.play("start");

             

            I did have a problem with the "1000" ms animation time for the scroll cause my animation had already started. I tried your code with the "complete" function and it worked well BUT my animation didn't honor any of the stop triggers. It started playing in the right place but then just played all the way thru the whole timeline which doesn't work for this project. There are lots of start , stops, and jump to labels and triggers in my project.  Different sections play with different mouse clicks etc.

            So I just decreased the scroll animation time to a 1/2 sec (500) and while it's still moving when the edge animation starts it works well enough. I guess I could add some kind of "wait" statement to the scroll to complete ?? Is there something like that in edge ?

             

            Thanks

             

            Joel H

             

            btw

            I have been unable to get <script> var v = 1 </script> in the <head> section of the page to be recognized by a function in EDGE is that possible ?