jquery slider ui question ("slide" vs "change" event..)
have following issue with jquery slider ui:
http://mayacove.com/dev/slider/slider2.html slider works only when you drag handle, i.e., when you drag the slider the divs show and hide as expected (divs change as s开发者_运维技巧lider slides..) but: if I CLICK on any point on slider instead of dragging, divs change ONLY if I click on a precise spot where a div is supposed to switch, otherwise div does not switch.. how do I fix this please??
( to make it simpler JS code is in slider2.html..)
thank you very much..
There isn't any code in your change event. I would recommend both slide and change calling a separate function which handles the events, so something like;
$slider.slider({
slide: SlideChangeEvent,
change: SlideChangeEvent
});
var SlideChangeEvent = function(e,ui){
var currVal = Math.round((19500*ui.value)/100);
$("#points-value").html(format(currVal));
for (i=0; i < intervals.length; i++) {
if (ui.value == intervals[i]) {
$("#points-value").html(format(intervalsPoints[i]));
$("#divs-to-show > div").hide();
$("#divs-to-show > div").eq(i).show();
}
}
};
Sorry i haven't tested it though, no reason why it shouldn't work though i don't think.
yes I know there's no code in my change event, because I don't know what code to put in there...!! ;-)
unfortunately code you posted doesn't work.. even slider value doesn't change..
http://mayacove.com/dev/slider/slider2a.html
thank you...
精彩评论