3 Replies Latest reply on Nov 26, 2013 10:30 AM by elainecc

    Can I target an external element from within Edge?

    jaypratt

      Hi,

       

      I need to target an external image from edge - the scenario is this:

       

      Edge animates to a frame, within the trigger on that frame I need to include JS that will do a JQuery (or similar) add/remove class on an image that is outside the animation. Is this possible?

       

      thanks in advance

       

      J

        • 1. Re: Can I target an external element from within Edge?
          elainecc Adobe Employee

          Hi, Jay-

           

          It's technically feasible, but the answer really depends on how you integrate the Animate project into your HTML file.  You can look up "iframe to parent communication" if you end up using an iframe.

           

          Hope that helps,

           

          -Elaine

          • 2. Re: Can I target an external element from within Edge?
            jaypratt Level 1

            Hi Elaine,

             

            Thanks for your reply.

             

            I have the animation in an iframe yes. What I am trying to do now is have a click event from a button within my animation, change a class on an element on the page the iframe is situated on. I have tried various suggestions and techniques but none seem to work.

             

            I am able to call an alert when the #Stage div is clicked but when i change the reference to any of the element classes from within the animation nothing happens.

             

            my code is below:

            var myFrame = $("#am-anim");

                     myFrame.load(function() {    // wait for iframe to load

             

                           var myButt = myFrame.contents().find(".assets-management"); //class name of the #Stage element within the iframe

             

                           $(myButt).click( function(){

             

                           alert('hello');

             

                           })

             

                     });

             

            this is appearing in my sites main .js file

             

            thanks in advance

             

            Jay

            • 3. Re: Can I target an external element from within Edge?
              elainecc Adobe Employee

              Hi, Jay-

               

              I'm confused.  Within Animate, you would probably use window.top or window.parent to access the parent page.  In the click event, you should be able to call a function defined on the parent page and change your CSS property.

               

              Hope that helps,

               

              -Elaine

              1 person found this helpful