Hi folks,
I'm just learning jquery so please bear with me. Not sure if this should go in the Using or Dev forum.
I have a image slider/scroller as you can see here:
http://test.kirilisa.com/old.php. This is using jquery 1.2.6 and ui 1.5.2. As you can see, it scrolls smoothly whether you drag the handle or just click somewhere in the slider bar.
I implemented the same thing with jquery 1.3.2 and ui 1.7.2 here:
http://test.kirilisa.com/ Now, however, though is scrolls smoothly when you drag the handle, it jumps to the spot if you just click in the slider bar.
My slider code is below: it seems to me to be an ordering thing: in the older jquery the stop event happens before the slide event, but in the newer version it's the other way round. I could be wrong about this guess though. In any case, can anyone tell me how to achieve the smooth scrolling on click, with the newer version of jquery?
Thanks!
- window.onload = function () {
- var mycont = $("#sliderContent");
- var viewer = $(".viewer", mycont);
- var conveyor = $(".content-conveyor", viewer);
- var items = $("ul", conveyor);
-
- var itemsWidth = items.innerWidth() - viewer.outerWidth();
- conveyor.css("width", items.innerWidth());
-
- var sliderOpts = {
- max: itemsWidth,
- stop: function (event, ui) {
- items.animate({'left' : ui.value * -1}, 500);
- },
- slide: function(e, ui) {
- items.css('left', ui.value * -1)
- },
- };
-
- $("#slider").slider(sliderOpts);
- };