5 Replies Latest reply on May 19, 2014 1:59 PM by jamesfootlight

    fadeOut command not working on some but not all? PLS HLP!

    jamesfootlight Level 1

      Hi,

       

      If you see attached, for some reason my fadeOut command for the rest of the countries when each button is clicked fails to fadeOut the rest of the countries and only USA and UK seem to work?


      This is my code for each button:


      sym.$("UKcountrybutton").fadeOut();

      sym.$("UKcountrybutton").fadeIn();

       

      sym.getSymbol("Countries").$("UK").fadeToggle();

      sym.getSymbol("Countries").$("USA","AUS","Hongkong","Switzerland","Ireland","India","Japan ","Netherlands","Spain").fadeOut();

       

      sym.getSymbol("Piecharts").$("UK").slideToggle();

      sym.getSymbol("Piecharts").$("USA","AUS","Hongkong","Switzerland","Ireland","India","Japan ","Netherlands","Spain").fadeOut();

       

      sym.getSymbol("Textwindows").$("UK").slideToggle();

      sym.getSymbol("Textwindows").$("USA","AUS","Hongkong","Switzerland","Ireland","India","Jap an","Netherlands","Spain").fadeOut();

       

      sym.$("SB").fadeToggle();

       

      See attached:

       

       

      Dropbox - Countries.zip

       

      any ideas, it's driving me mad!

        • 1. Re: fadeOut command not working on some but not all? PLS HLP!
          jbowden Adobe Employee

          Hi there,

           

          It's not possible to target more than one element as you are trying to do using a single jQuery selector. In other words, this will only ever fade out just the first element ("USA") in the Piecharts symbol:

           

          sym.getSymbol("Piecharts").$("USA","AUS","Hongkong","Switzerland","Ireland","India","Japan ","Netherlands","Spain").fadeOut();

           

          Instead, you need to set up an array of the different elements you want to fade out, and loop through them. Or you could assign a class to them, and then fade out all members of the class.

           

          One other point: please try to stay on a single thread for your question. You already have several threads on the same topic.

           

          Thanks,

          Joe

          1 person found this helpful
          • 2. Re: fadeOut command not working on some but not all? PLS HLP!
            jamesfootlight Level 1

            Thanks, but I don't really understand how to make an array work?

             

            if you download my project and have a look you will see that a class won't work as i can't group all the elements into one class as i need to fade toggle a different one for each country and fade out the rest i.e.: when i click the UK button i need to fade toggle the UK png and fade out the other countries

            when i click the USA button i need to fade toggle the USA ing and fade out the other countries and so on

            can you help?

             

            ps i have multiple threads because no one has been able to understand my initial question and therefore give me the correct answer!

            • 3. Re: fadeOut command not working on some but not all? PLS HLP!
              jamesfootlight Level 1

              let me elabaorate:

               

              I need to fade toggle a different country png for each country button and fade out the rest of the country images i.e.: when i click the UK button i need to fade toggle the UK png and fade out the other countries

              when i click the USA button i need to fade toggle the USA ing and fade out the other countries and so on

               

              sym.getSymbol("Countries").$("UK").fadeToggle();sym.getSymbol("Countries").$("USA","AUS","Hongkong","Switzerland","Ireland","Indias","Japa n","Netherlands","Spain").fadeOut();

               

               

              sym.getSymbol("Countries").$("USA").fadeToggle();sym.getSymbol("Countries").$("UK","AUS","Hongkong","Switzerland","Ireland","Indias","Japan ","Netherlands","Spain").fadeOut();

               

              but it doesn't seem to work how i have it and i have been told to do an array but I'm not sure how?

              etc

              can you help?

              • 4. Re: fadeOut command not working on some but not all? PLS HLP!
                jbowden Adobe Employee

                Hi there,

                 

                I've created an example file that should be helpful to understanding how to do this with an array:

                 

                http://adobe.ly/1gWviOE

                 

                It has a function named fadeOthers in the compositionReady handler that contains three things:

                1. An array of all the country (element) names
                2. A splice operation to remove the calling element from the array
                3. A for loop that loops through the remainder of array and does a fadeOut on all the remaining country elements.

                 

                Each country element calls this function with its own element name as an argument, i.e., sym.fadeOthers("USA"); on the USA element.

                 

                The function itself is well-commented and there's also a reset button that fades all elements back in, so you can try each one country without reloading the page. You can then apply the concepts explained in my example to your composition to make other elements fade as you want.

                 

                hth,

                Joe