[ 2 posts ]

Tony de Leon Suero

  • Username: tonydeleon
  • Joined: Sat Nov 19, 2011 5:02 pm
  • Posts: 5
  • GitHub: tonydeleon
  • Gists: tonydeleon
  • IRC: tonydeleon
  • Offline
  • Profile

slider problem

Post Posted: Sat Nov 19, 2011 5:51 pm
+0-
Hello From Santo Domingo !! , I need your help please.

I'm using an Horizontal Slider with two thumbs YUI 2.9.0, but I insert the code on a search form inside of an Ajax Update Panel. The slider is working good but when I click the submit button of the form the slider freeze and doesn't work.
What can I do to resolve that ?

This is the code of the Slider I'm Using

Code:
<script type="text/javascript">
(function () {
    YAHOO.namespace('example');

    var Dom = YAHOO.util.Dom;
      var range = 200;
    var tickSize = 0;
    var minThumbDistance = 10;
    var initValues = [100,130];
    var cf = 900/(range - 20);
    var convert = function (val) {
        return Math.round(val * cf + 100);
    };

    YAHOO.util.Event.onDOMReady(function () {
        var demo_bg = Dom.get("demo_bg"),
            info    = Dom.get("infoprice"),
            from    = Dom.get("fromprice"),
            to      = Dom.get("toprice");

        var slider = YAHOO.widget.Slider.getHorizDualSlider(demo_bg,
            "demo_min_thumb", "demo_max_thumb",
            range, tickSize, initValues);

        slider.minRange = minThumbDistance;
       
        var updateUI = function () {
            from.value = slider.minVal;
            to.value   = slider.maxVal;
            var min = convert(slider.minVal),
             max = convert(slider.maxVal - 20);

            info.innerHTML = "MIN: <strong>" + min + "</strong><br>" +
                             "MAX: <strong>" + max + "</strong>";
            demo_bg.title  = "Current range " + min + " - " + max;
        };

        slider.subscribe('ready', updateUI);
        slider.subscribe('change', updateUI);

        YAHOO.util.Event.on('demo_btn','click',function () {
            var min = Math.abs(parseInt(from.value,10)|0),
                max = Math.abs(parseInt(to.value,10)|0);

            if (min > max) {
                var hold = min;
                min = max;
                max = hold;
            }
            min = Math.min(min,range - 30);
            max = Math.max(Math.min(max,range),min + 20 + minThumbDistance);

        });
    });
})();
</script>

Luke Smith

YUI Contributor

  • Username: lsmith
  • Joined: Thu Aug 28, 2008 7:50 am
  • Posts: 510
  • Location: Sunnyvale
  • Twitter: ls_n
  • GitHub: lsmith
  • Gists: lsmith
  • IRC: ls_n
  • YUI Developer
  • Offline
  • Profile

Re: slider problem

Post Posted: Mon Nov 21, 2011 10:08 pm
+0-
This is just the example code. Likely your issue is coming from the code that's related to handling the form submission.
  [ 2 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum