Loading ...
Sorry, an error occurred while loading the content.

Slider error when hidden!

Expand Messages
  • chochis
    Hello All: I had a positioning error on slider thumb position when changing the display style from block to none. When trying to set a new value to the slider
    Message 1 of 11 , Nov 23, 2006
    • 0 Attachment
      Hello All:
      I had a positioning error on slider thumb position when changing the
      display style from block to none. When trying to set a new value to
      the slider it failed to position it on the right one.

      So, I founded that getOffsetFromParent function was returnin NaN in
      some cases and made it fail.

      I had changed the code so, now, it works fine.

      getOffsetFromParent: function(parentPos) {
      var myPos = YAHOO.util.Dom.getXY(this.getEl());
      var ppos = parentPos || YAHOO.util.Dom.getXY(this.parentElId);
      var x = parseInt(myPos[0]) - parseInt(ppos[0]);
      var y = parseInt(myPos[1]) - parseInt(ppos[1]);
      x = parseInt(x);
      y = parseInt(y);
      if (isNaN(x)){
      x = 0;
      }
      if (isNaN(y)){
      y = 0;
      }
      return [ x, y];
      },

      Hope that this helps!

      Thanks!
      José Luis
    • Alessandro Vernet
      ... Yes! I have the same problem with YUI 0.12.0 (I haven t checked if the issue is still there in 0.12.1). I documented the fix I have done for 0.12.0 on the
      Message 2 of 11 , Dec 29, 2006
      • 0 Attachment
        chochis wrote:
        >
        > I had a positioning error on slider thumb position when changing the
        > display style from block to none. When trying to set a new value to
        > the slider it failed to position it on the right one.
        >
        > So, I founded that getOffsetFromParent function was returnin NaN in
        > some cases and made it fail.
        >

        Yes! I have the same problem with YUI 0.12.0 (I haven't checked if the issue
        is still there in 0.12.1). I documented the fix I have done for 0.12.0 on
        the page linked below (look for slider.js).

        https://wiki.objectweb.org/ops/Wiki.jsp?page=YUI

        Your millage may vary with this fix:

        * If you are using the vertical slider you will want to change getYValue()
        as well.
        * This might not work if your slider starts at a position other than 0.

        Now a question for our friends at Yahoo!: is a fix for this planned for a
        future version of YUI? Of course let me know if the problem as described in
        this thread is not clear.

        Alex
        --
        Blog (XML, Web apps, Open Source):
        http://www.orbeon.com/blog/

        --
        View this message in context: http://www.nabble.com/Slider-error-when-hidden%21-tf2693415.html#a8093841
        Sent from the ydn-javascript mailing list archive at Nabble.com.
      • Alessandro Vernet
        ... Did anyone from Yahoo! get a chance to look at this fix and see of this is something that would be worth integrating in YUI? Alex -- Orbeon Forms - Web
        Message 3 of 11 , Feb 1, 2007
        • 0 Attachment
          Alessandro Vernet wrote:
          >
          > Yes! I have the same problem with YUI 0.12.0 (I haven't checked if the
          > issue is still there in 0.12.1). I documented the fix I have done for
          > 0.12.0 on the page linked below (look for slider.js).
          >
          > https://wiki.objectweb.org/ops/Wiki.jsp?page=YUI
          >

          Did anyone from Yahoo! get a chance to look at this fix and see of this is
          something that would be worth integrating in YUI?

          Alex
          --
          Orbeon Forms - Web Forms for the Enterprise, Done the Right Way
          http://www.orbeon.com/

          --
          View this message in context: http://www.nabble.com/Slider-error-when-hidden%21-tf2693415.html#a8761489
          Sent from the ydn-javascript mailing list archive at Nabble.com.
        • Eric Miraglia
          Alessandro, Is there a reason why you would set display:none on the thumb of a slider instead of visibility:hidden? Regards, Eric
          Message 4 of 11 , Feb 1, 2007
          • 0 Attachment
            Alessandro,

            Is there a reason why you would set display:none on the thumb of a slider instead of visibility:hidden?

            Regards,
            Eric


            ______________________________________________
            Eric Miraglia
            Yahoo! User Interface Library



            On Feb 1, 2007, at 8:12 PM, Alessandro Vernet wrote:



            Alessandro Vernet wrote:
            >
            > Yes! I have the same problem with YUI 0.12.0 (I haven't checked if the
            > issue is still there in 0.12.1). I documented the fix I have done for
            > 0.12.0 on the page linked below (look for slider.js).
            >
            > https://wiki.objectweb.org/ops/Wiki.jsp?page=YUI
            >

            Did anyone from Yahoo! get a chance to look at this fix and see of this is
            something that would be worth integrating in YUI?

            Alex
            --
            Orbeon Forms - Web Forms for the Enterprise, Done the Right Way
            http://www.orbeon.com/

            --
            View this message in context: http://www.nabble.com/Slider-error-when-hidden%21-tf2693415.html#a8761489
            Sent from the ydn-javascript mailing list archive at Nabble.com.


          • Alessandro Vernet
            Hi Eric, ... Sorry, I feel I am missing something: where am I am setting display:none on the thumb? Alex -- Orbeon Forms - Web Forms for the Enterprise, Done
            Message 5 of 11 , Feb 2, 2007
            • 0 Attachment
              Hi Eric,


              Eric Miraglia wrote:
              >
              > Is there a reason why you would set display:none on the thumb of a
              > slider instead of visibility:hidden?
              >

              Sorry, I feel I am missing something: where am I am setting display:none on
              the thumb?

              Alex
              --
              Orbeon Forms - Web Forms for the Enterprise, Done the Right Way
              http://www.orbeon.com/

              --
              View this message in context: http://www.nabble.com/Slider-error-when-hidden%21-tf2693415.html#a8779163
              Sent from the ydn-javascript mailing list archive at Nabble.com.
            • Eric Miraglia
              Alex, See the original post in this thread... http://tech.groups.yahoo.com/group/ydn-javascript/message/7971 Perhaps I am not clear on what the exact issue is
              Message 6 of 11 , Feb 3, 2007
              • 0 Attachment
                Alex,

                See the original post in this thread...


                Perhaps I am not clear on what the exact issue is here.

                Regards,
                Eric


                ______________________________________________
                Eric Miraglia
                Yahoo! User Interface Library



                On Feb 2, 2007, at 7:27 PM, Alessandro Vernet wrote:


                Hi Eric,

                Eric Miraglia wrote:
                >
                > Is there a reason why you would set display:none on the thumb of a
                > slider instead of visibility:hidden?
                >

                Sorry, I feel I am missing something: where am I am setting display:none on
                the thumb?

                Alex
                --
                Orbeon Forms - Web Forms for the Enterprise, Done the Right Way
                http://www.orbeon.com/

                --
                View this message in context: http://www.nabble.com/Slider-error-when-hidden%21-tf2693415.html#a8779163
                Sent from the ydn-javascript mailing list archive at Nabble.com.


              • Alessandro Vernet
                ... Eric, Sorry, I got confused. So, the problem we have here happens when the slider is hidden when the page is initially loaded. The slider is initially
                Message 7 of 11 , Feb 6, 2007
                • 0 Attachment
                  Eric Miraglia wrote:
                  >
                  > Alex,
                  >
                  > See the original post in this thread...
                  >
                  > http://tech.groups.yahoo.com/group/ydn-javascript/message/7971
                  >
                  > Perhaps I am not clear on what the exact issue is here.
                  >

                  Eric,

                  Sorry, I got confused. So, the problem we have here happens when the slider
                  is hidden when the page is initially loaded. The slider is initially hidden
                  with display: none, which is then changed in JavaScript into display: block.

                  The reason we use display: none instead of visibility hidden is that we
                  don't want the slider to take any space in the layout.

                  Concretely, the slider is in a "tab" which is not displayed when the page
                  first loads. The tab is a div with display: none. When you click on the tab,
                  the display of this tab is changed to "block" and the slider becomes
                  visible. You can see this in action (click on the "Range" tab):

                  http://www.orbeon.com/ops/xforms-controls/

                  Is there any chance that sliders initially hidden will work out of the box
                  in the next version of YUI?

                  Alex
                  --
                  Orbeon Forms - Web Forms for the Enterprise, Done the Right Way
                  http://www.orbeon.com/
                  --
                  View this message in context: http://www.nabble.com/Slider-error-when-hidden%21-tf2693415.html#a8837477
                  Sent from the ydn-javascript mailing list archive at Nabble.com.
                • Eric Miraglia
                  Alex, The problem, I suspect, is that that using the display property to hide your slider is preventing some necessary computation from being done on the part
                  Message 8 of 11 , Feb 7, 2007
                  • 0 Attachment
                    Alex,

                    The problem, I suspect, is that that using the display property to hide your slider is preventing some necessary computation from being done on the part of Drag and Drop (Slider is an implementation of Drag and Drop).  When elements are styled as display:none, there are certain aspects of their style object that cannot be read or manipulated. 

                    Another approach that should solve your problem is to load the page with your slider set with visibility:hidden and position:absolute.  This will take it out of the page flow and make it invisible, just like display:none, but without the harmful side effects.

                    Regards,
                    Eric


                    ______________________________________________
                    Eric Miraglia
                    Yahoo! User Interface Library



                    On Feb 6, 2007, at 4:21 PM, Alessandro Vernet wrote:



                    Eric Miraglia wrote:
                    >
                    > Alex,
                    >
                    > See the original post in this thread...
                    >
                    > http://tech.groups.yahoo.com/group/ydn-javascript/message/7971
                    >
                    > Perhaps I am not clear on what the exact issue is here.
                    >

                    Eric,

                    Sorry, I got confused. So, the problem we have here happens when the slider
                    is hidden when the page is initially loaded. The slider is initially hidden
                    with display: none, which is then changed in JavaScript into display: block.

                    The reason we use display: none instead of visibility hidden is that we
                    don't want the slider to take any space in the layout.

                    Concretely, the slider is in a "tab" which is not displayed when the page
                    first loads. The tab is a div with display: none. When you click on the tab,
                    the display of this tab is changed to "block" and the slider becomes
                    visible. You can see this in action (click on the "Range" tab):

                    http://www.orbeon.com/ops/xforms-controls/

                    Is there any chance that sliders initially hidden will work out of the box
                    in the next version of YUI?

                    Alex
                    --
                    Orbeon Forms - Web Forms for the Enterprise, Done the Right Way
                    http://www.orbeon.com/
                    --
                    View this message in context: http://www.nabble.com/Slider-error-when-hidden%21-tf2693415.html#a8837477
                    Sent from the ydn-javascript mailing list archive at Nabble.com.


                  • Alessandro Vernet
                    Eric, ... This is a good point. I will try this approach. Alex -- Orbeon Forms - Web 2.0 Forms for the Enterprise http://www.orbeon.com/ -- View this message
                    Message 9 of 11 , Feb 28, 2007
                    • 0 Attachment
                      Eric,


                      Eric Miraglia wrote:
                      >
                      > Another approach that should solve your problem is to load the page
                      > with your slider set with visibility:hidden and position:absolute.
                      > This will take it out of the page flow and make it invisible, just
                      > like display:none, but without the harmful side effects.
                      >

                      This is a good point. I will try this approach.

                      Alex
                      --
                      Orbeon Forms - Web 2.0 Forms for the Enterprise
                      http://www.orbeon.com/
                      --
                      View this message in context: http://www.nabble.com/Slider-error-when-hidden%21-tf2693415.html#a9242608
                      Sent from the ydn-javascript mailing list archive at Nabble.com.
                    • Alessandro Vernet
                      Eric, ... I am not sure if a follow-up on a thread almost two years after the last message is considered good etiquette :), but your suggestion works
                      Message 10 of 11 , Nov 12, 2008
                      • 0 Attachment
                        Eric,


                        Alessandro Vernet wrote:
                        >
                        > Eric,
                        >
                        >
                        > Eric Miraglia wrote:
                        >>
                        >> Another approach that should solve your problem is to load the page
                        >> with your slider set with visibility:hidden and position:absolute.
                        >> This will take it out of the page flow and make it invisible, just
                        >> like display:none, but without the harmful side effects.
                        >>
                        >
                        > This is a good point. I will try this approach.
                        >

                        I am not sure if a follow-up on a thread almost two years after the last
                        message is considered good etiquette :), but your suggestion works
                        beautifully. Thanks!

                        Alex

                        -----
                        Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
                        Orbeon's Blog: http://www.orbeon.com/blog/
                        Personal Blog: http://avernet.blogspot.com/
                        Twitter - http://twitter.com/avernet
                        --
                        View this message in context: http://www.nabble.com/Slider-error-when-hidden%21-tp7511024p20473451.html
                        Sent from the ydn-javascript mailing list archive at Nabble.com.
                      • Eric Miraglia
                        Alex, I m glad the solution worked for you -- and that we re all still here having fun with YUI two years later! -Eric
                        Message 11 of 11 , Nov 12, 2008
                        • 0 Attachment
                          Alex,

                          I'm glad the solution worked for you -- and that we're all still here having fun with YUI two years later!

                          -Eric


                          On Nov 12, 2008, at 6:02 PM, Alessandro Vernet wrote:


                          Eric,

                          Alessandro Vernet wrote:
                          > 
                          > Eric,
                          > 
                          > 
                          > Eric Miraglia wrote:
                          >> 
                          >> Another approach that should solve your problem is to load the page 
                          >> with your slider set with visibility:hidden and position:absolute. 
                          >> This will take it out of the page flow and make it invisible, just 
                          >> like display:none, but without the harmful side effects.
                          >> 
                          > 
                          > This is a good point. I will try this approach.
                          > 

                          I am not sure if a follow-up on a thread almost two years after the last
                          message is considered good etiquette :), but your suggestion works
                          beautifully. Thanks!

                          Alex

                          -----
                          Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
                          Orbeon's Blog: http://www.orbeon. com/blog/
                          Personal Blog: http://avernet. blogspot. com/
                          Twitter - http://twitter. com/avernet
                          -- 
                          View this message in context: http://www.nabble. com/Slider- error-when- hidden%21- tp7511024p204734 51.html
                          Sent from the ydn-javascript mailing list archive at Nabble.com.


                        Your message has been successfully submitted and would be delivered to recipients shortly.