6 Replies Latest reply on May 23, 2013 3:41 AM by JørgenX

    Can't hide symbol


      This code works fine:




      But this code doesn't work:




      The two lines of code are in the same function.


      What is the problem with hide?




        • 1. Re: Can't hide symbol
          TimJaramillo Level 4

          Can you post your file Jorgen? Are you getting any errors in your console? Your code looks like it should work.


          Note that if you're trying to hide ("orangeBtn"+i), you can make it shorter, like this (using jQuery shorthand):


          sym.$( "orangeBtn"+i ).hide();

          • 2. Re: Can't hide symbol
            JørgenX Level 1

            Thank you, Tim!

            I posted a link to a zip-file with my project in a private message.

            • 3. Re: Can't hide symbol
              TimJaramillo Level 4

              Hey Jorgen, I noticed 2 small errors in your "for loop".


              On line 69 (i=i is incorrect. And you have 4 buttons, so it should iterate from 0 to 3, or <4, not 5):

              So change this:

              for (i=i; i<5; i++){


              to this:

              for (i=0; i<4; i++){


              The main issue seems to be some conflict with hide(), but animate() works:


              for (i = 0;i<4;i++){

                   sym.$("orangeBtn"+i).animate({opacity:0}, 0);

              • 4. Re: Can't hide symbol
                JørgenX Level 1

                Hey Tim, thank you!


                The for loops works allright: The first for-loop populates 2-5 buttons with texts from a json-file. The second for loop hides the remaining buttons. Of course I would like to use the hide method of the buttons in the second for loop, but that is impossible. In stead I set opacity to 0, set the cursor to default and unbind the click handler. But I don't understand, why hide isn't working!



                • 5. Re: Can't hide symbol
                  TimJaramillo Level 4

                  Hey Joergen,


                  It looks like Edge is overriding the "hide" method (which is basically css, display:none) for some weird reason. I noticed you had the "display" property set for these symbols on the timeline, so I thought that might be overriding the "hide" method, (which is basically display:none), but after removing the timeline "display" prop, I'm still not able to hide the btns with "hide()" or "display":"none".


                  Note that the jQuery "remove" method does work to get rid of the unused buttons, but it triggers an Edge error (this doesn't seem to affect the functionality thoug)


                  This works:



                  But causes this Edge error:

                  Uncaught TypeError: Cannot read property 'edgeSymbol' of undefined

                  • 6. Re: Can't hide symbol
                    JørgenX Level 1

                    Hey Tim,


                    I tried css "visibility":"hidden" and it worked!

                    Thank you for great help :-)