sachinchoolur / lightslider

JQuery lightSlider is a lightweight responsive Content slider with carousel thumbnails navigation
http://sachinchoolur.github.io/lightslider/
MIT License
2.04k stars 1.52k forks source link

Reg Lightslider-Having issue with mouse scroll #241

Open nithinchalakkal opened 8 years ago

nithinchalakkal commented 8 years ago

Hi ,First of all thanks for the excellent slider..!!! I'm facing an issue while i set the slider setting variable rtl to to true as i need to slide the slider from right to left for my arabic site. The issue is that while i set it to true,and when i drag the slider,the slider moves in opposite to that of the direction in which i scroll.ie,If i scroll from left to right,the slider moves from right to left.

Any help on this will be really appreciated.!!!!!!!!!!

av4ajay commented 8 years ago

Hi Nithin,Me too faced the same issue with lightslider. Inorder to fix this,you need to edit the lightslider.js file Inside touch end function,after var mxVal = false var _next = true; add the below line: if (settings.rtl === true ) { distance = -distance;}

and inside mousemove function when dragging add the below code

if (settings.rtl === true) { $this.touchMove(startCoords, endCoords); }else{ $this.touchMove(endCoords, startCoords); }

Hope this will fix the issue.. Happy Coding :)

iranwz commented 8 years ago

@av4ajay Thanks, It works. Preview: http://akhtarcable.com

nithinchalakkal commented 8 years ago

OMG !!!!!! @av4ajay
This wot i really need :) 👯

mortezadalil commented 7 years ago

thanx

wriahasan commented 6 years ago

I have the same problem and used the above code, it works but the slides don't move smoothly, Could you please help me?

idl4it commented 5 years ago

solution av4ajay gave worked but partial instead I only added line mentioned below in touchMove function and touchEnd function:

touchMove: function (endCoords, startCoords) {
                $slide.css('transition-duration', '0ms');
                if (settings.mode === 'slide') {
                    var distance = endCoords - startCoords;

                    if (settings.rtl === true ) { distance = -distance;} // added this line after above 

and in touchEnd function as :

$slide.css('transition-duration', settings.speed + 'ms');
                if (settings.mode === 'slide') {
                    var mxVal = false;
                    var _next = true;

                    if (settings.rtl === true ) { distance = -distance;} // added this line after above code

thanks @av4ajay