3 Replies Latest reply on Dec 31, 2012 7:01 AM by joel_pau

    Help?! Class address question

    Comfunex Level 2

      Hoy!

       

      After I declare a Class to a Symbol, how do I for example address all the symbols css with the same class?

       

      Elijahu

        • 1. Re: Help?! Class address question
          jbowden Adobe Employee

          Hi there,

           

          Do you mean how do you style the class? You can add the class to your stylesheet, and that should apply the styles in the class to all elements/symbols that have that class.

           

          If you mean how do you do this dynamically, you'd use jQuery.

           

          hth,

          Joe

          • 2. Re: Help?! Class address question
            Comfunex Level 2

            i've tried access it through:

             

            function check() {

                console.log("hello there");

                var items = document.querySelectorAll(".box");

                for (i = 0; i < items.length; i++) {

                    items[i].onclick = showinfo;

                }

            }

            function showinfo(e) {

                temp2 = e.target;

                console.log(temp2);

            }

             

            with no success

            • 3. Re: Help?! Class address question
              joel_pau Level 5

              Hi,

               

              Here is an example using classes, tag and click events: attached file.

              Your code could be:

              $('.box').on("click", function(){ .... });

               

              I summarize: you can use this or e.target.

               

              1) Code using e.target:


              sym.$("Stage").children().css("cursor", "pointer");

              // Tag [p] and both classes [rectangles, ellipses] were added using Edge UI.

              $('p').on("click", function(e){

                          $(e.target).html("clicked :)").css("color","blue");

                          console.log(e.target);

              });

              $('.ellipses').on("click", function(e){

                          $(e.target).css("background-color", "orange");

                          console.log(e.target);

              });

              $('.rectangles').on("click", function(e){

                          $(e.target).css("background-color", "red");

                          console.log(e.target);

              });

               

              2) Code using this (see attachments):

               

              sym.$("Stage").children().css("cursor", "pointer");

              // Tag [p] and both classes [rectangles, ellipses] were added using Edge UI.

              $('p').on("click", function(){ $(this).html("clicked :)").css("color","blue") });

              $('.ellipses').on("click", function(){ $(this).css("background-color", "orange") });

              $('.rectangles').on("click", function(){ $(this).css("background-color", "red") });