Skip to main content

Search and Top Navigation

#4412 closed bug (duplicate)

Opened March 30, 2009 08:36AM UTC

Closed May 07, 2009 12:52PM UTC

Last modified June 04, 2009 09:40AM UTC

Slider is initialized with animate and event-functions but they got lost by using methods

Reported by: leeperry Owned by:
Priority: minor Milestone: 1.8
Component: ui.slider Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:
Description

The Slider is initialized by following code:


var min = 2000;
var max = 2009;

$("#slider").slider({
        animate: true,
        min:    min,
        max:    max,
        change: function(event, ui) {
                $("#timeline_years li[class*='year']").removeClass("active");
                $("#timeline_years li.year"+ui.value).addClass("active");
        },
        slide: function(event, ui) {
                $("#timeline_years li[class*='year']").removeClass("active");
                $("#timeline_years li.year"+ui.value).addClass("active");
        },
        stop: function(event, ui) {
                changeInfo(ui.value);
        }

});

this works all fine inside the slider area.

BUT when I want to control the slider outside the slider area like:


$("#outsideSlider").click(function(){
        $("#slider").slider('value',min);
});

The indicator will move directly to the choosen value, but without any initialized option, that means no animation and no event function.

A reinitialization of the Slider or the redeclaration of all options with following code doesn't work either:


$("#outsideSlider").click(function(){ 
        $("#slider").slider('option',{
                animate: true,
                min:    min,
                max:    max,
                value:  min,
                change: function(event, ui) {
                        $("#timeline_years li[class*='year']").removeClass("active");
                        $("#timeline_years li.year"+ui.value).addClass("active");
                },
                slide: function(event, ui) {
                        $("#timeline_years li[class*='year']").removeClass("active");
                        $("#timeline_years li.year"+ui.value).addClass("active");
                },
                stop: function(event, ui) {
                        changeInfo(ui.value);
                }
        }); 
});

It will move, but also without animation and without any event-function.

Attachments (0)
Change History (3)

Changed May 07, 2009 10:46AM UTC by jzaefferer comment:1

milestone: TBD1.7.2

Not triggering events when programatically changing the value is intended behaviour (by design).

I'm not sure about the animation. It makes sense that it should be animated.

Changed May 07, 2009 12:52PM UTC by jzaefferer comment:2

resolution: → duplicate
status: newclosed

See comment above for event handling, otherwise duplicate of #4432.

Changed June 04, 2009 09:40AM UTC by rdworth comment:3

milestone: 1.7.21.8