I have a Slider with fractions and an onSlide handler.  Sometimes when
the handler is invoked, the reported value for xProc seems to be
"lagging" -- it seems to be the value from just before the slider
jumped to its current position.  Has anyone else seen this problem?

I'd like to post an example but am not sure how Google Groups will
handle the formatting.  So for now, here's a fragment to demonstrate
the problem.

        <div id="slider_frame">
            <div id="bar">
                <div id="indicator" class="Indicator"></div>
            </div>
        </div>
        <p id="msg"></p>
...
            var f = 5;
            var slider = $("#bar").Slider({
                accept: "#indicator",
                fractions: f,
                onSlide: function(xProc, yProc, x, y) {
                    var fraction = x / this.dragCfg.containerMaxx;
                    var expected = Math.round(100 * fraction / (f -
1)) * (f - 1);
                    $("#msg").html("Expected " + expected + ", got " +
xProc);

In the web app where I've encountered this problem, I've been able to
work around it by recomputing the xProc value in my onSlide function:
        var fraction = x / this.dragCfg.containerMaxx;
        var f = this.dragCfg.fractions;
        xPercent = Math.round(100 * fraction / (f - 1)) * (f - 1);

A more complete example is available at:
http://bottledtext.blogspot.com/2007/06/bug-with-jquery-112-interface-12-slider.html

Reply via email to