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

Re: Change Slider Parameters dynamically

Expand Messages
  • y_lsmith
    ... You can use sliderA.thumb.setXConstraint(newLeftConstraint, newRightConstraint); and the same for sliderB. DualSlider does something very similar with its
    Message 1 of 4 , Aug 30, 2009
    • 0 Attachment
      --- In ydn-javascript@yahoogroups.com, "hendrik.worschech" <hendrik.worschech@...> wrote:
      >
      > Hi guys,
      >
      > I have 2 sliders:
      >
      > slider = YAHOO.widget.Slider.getHorizSlider(bg, thumb, 0, 200, 2);
      >
      > slider2 = YAHOO.widget.Slider.getHorizSlider(bg2,thumb2, 0, 200, 2);
      >
      >
      > The sliders can each move 200 pixels individually but I want that they are dependable on each others values.
      >
      > Meaning when the first slider is moved to 150, the second should not go more than 50 pixels and vice versa.
      >
      > Or when the first slider is moved to 30, the second should not go more than 170 pixels.
      >
      > Or when the first slider is moved to 200 the user shouldn't be able to move the second at all.
      >
      > How can I do that? Can I change the parameters (meaning bottomConstraint) after I have already initialized the sliders? Or other ways?
      >
      > Thank you.
      >
      > Hendrik
      >

      You can use sliderA.thumb.setXConstraint(newLeftConstraint, newRightConstraint);

      and the same for sliderB.

      DualSlider does something very similar with its thumbs, so you might peek under the hood to see any caveats.

      Luke
    • hendrik.worschech
      ... Hi Luke, thank you for your reply. I have actually been looking into YUI 3 in the meantime and like it more already (although it s just a beta yet). I have
      Message 2 of 4 , Aug 30, 2009
      • 0 Attachment
        --- In ydn-javascript@yahoogroups.com, "y_lsmith" <lucas.e.smith@...> wrote:
        >
        > --- In ydn-javascript@yahoogroups.com, "hendrik.worschech" <hendrik.worschech@> wrote:
        > >
        > > Hi guys,
        > >
        > > I have 2 sliders:
        > >
        > > slider = YAHOO.widget.Slider.getHorizSlider(bg, thumb, 0, 200, 2);
        > >
        > > slider2 = YAHOO.widget.Slider.getHorizSlider(bg2,thumb2, 0, 200, 2);
        > >
        > >
        > > The sliders can each move 200 pixels individually but I want that they are dependable on each others values.
        > >
        > > Meaning when the first slider is moved to 150, the second should not go more than 50 pixels and vice versa.
        > >
        > > Or when the first slider is moved to 30, the second should not go more than 170 pixels.
        > >
        > > Or when the first slider is moved to 200 the user shouldn't be able to move the second at all.
        > >
        > > How can I do that? Can I change the parameters (meaning bottomConstraint) after I have already initialized the sliders? Or other ways?
        > >
        > > Thank you.
        > >
        > > Hendrik
        > >
        >
        > You can use sliderA.thumb.setXConstraint(newLeftConstraint, newRightConstraint);
        >
        > and the same for sliderB.
        >
        > DualSlider does something very similar with its thumbs, so you might peek under the hood to see any caveats.
        >
        > Luke
        >

        Hi Luke,

        thank you for your reply.

        I have actually been looking into YUI 3 in the meantime and like it more already (although it's just a beta yet).

        I have one question, though: Is it possible to have a ticksize in the slider widget in YUI3? I didn't find any obvious solution.

        Is there a work around?

        Thank you.

        hendrik
      • y_lsmith
        ... I m glad you like 3.0! Ticks were left out of the base Slider component in favor of using a plugin to add the functionality. I have some work done on this
        Message 3 of 4 , Aug 31, 2009
        • 0 Attachment
          --- In ydn-javascript@yahoogroups.com, "hendrik.worschech" > Hi Luke,
          >
          > thank you for your reply.
          >
          > I have actually been looking into YUI 3 in the meantime and like it more already (although it's just a beta yet).
          >
          > I have one question, though: Is it possible to have a ticksize in the slider widget in YUI3? I didn't find any obvious solution.
          >
          > Is there a work around?
          >
          > Thank you.
          >
          > hendrik
          >

          I'm glad you like 3.0!

          Ticks were left out of the base Slider component in favor of using a plugin to add the functionality. I have some work done on this plugin, but it's not currently in 3.0beta1 and it won't drop in the pending 3.0 GA. If all goes well, it should show up in 3.1 later this year.

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