I have two instances of this carousel to test with, one with 7 slides and the other with 25. They run the exact same code. The 7 slide instance drags smoothly forever as intended, but the 25 slide instance is choppy when dragging.Something in the dragMove event is slowing down execution when the slide count is higher, and I'd like to find a way to improve it so that the slide count has no effect on performance.I've already tried a few optimizations, like replacing:$slider.children().last()with $Slider[0].lastChildTo bypass instantiating of all those unnecessary Jquery objects just to get the last one, but dragging is still choppy.Here's the dragMove event:function dragMove(event){  var ev = event.originalEvent || event || window.event;        var MousePosition = GetEventCoordinates(ev);        var MouseMoveDistance = (MousePosition.x-locals.StartingMousePosition.x);  var DistanceDifference = (locals.LastMouseMoveDistance-MouseMoveDistance);  var MoveDirection = (DistanceDifference === 0 || isNaN(DistanceDifference)) ? locals.LastMoveDirection : (DistanceDifference>0) ? '<' : '>' ; // negative to the left  var StepsMoved = Math.floor(MouseMoveDistance/base.protected.ItemWidth);  var StepsDifference = (locals.LastStepsMoved-StepsMoved);  if(StepsDifference !== 0 || locals.LastMoveDirection !== MoveDirection){     // Steps has changed, recalculate!     var oEdgeCounts = base.GetEdgeCounts();     if(oEdgeCounts.left<1 && MoveDirection==='>'){        // There are non to the left, but we need some!        if(StepsDifference===0){StepsDifference=1;}        for(var i=0; i<Math.abs(StepsDifference); i++){                          $Last = $(base.protected.$Slider[0].lastChild);           base.protected.$Slider.prepend($Last);        }        locals.PopAdjustment = (locals.PopAdjustment+(Math.abs(StepsDifference)*base.protected.ItemWidth));     }     if(oEdgeCounts.right<1 && MoveDirection==='<'){        //There are none to the right, but we need some!        if(StepsDifference===0)StepsDifference=1;        for(var i=0; i<Math.abs(StepsDifference); i++){                          $First = $(base.protected.$Slider[0].firstChild);           base.protected.$Slider.append($First);        }        locals.PopAdjustment = (locals.PopAdjustment-(Math.abs(StepsDifference)*base.protected.ItemWidth));     }  }        locals.NewSliderLeft = GetEventCoordinates(ev).x - locals.DragStartTouchOffsetX-locals.PopAdjustment;        // Save values so we can compare on next event        locals.LastSampleMousePosition = MousePosition;  locals.LastMouseMoveDistance = MouseMoveDistance;  locals.LastMoveDirection = MoveDirection;  locals.LastStepsMoved = StepsMoved;  base.protected.$Slider.css('left',locals.NewSliderLeft);}Here is the get Edge count function. It uses simple math to determin the number of slides off the left and off the right sides. I don't think it's speed is impacted by slide count.GetEdgeCounts = function(){          var base = this;          var SliderLeft = parseInt(base.protected.$Slider.css('left'),10);   var OffLeftCount = Math.abs(SliderLeft)/base.protected.ItemWidth;   var OffLeftFloor = Math.floor(OffLeftCount);   var OffRightCount = base.protected.TotalItems-base.protected.ItemsPerPage-OffLeftCount;   var OffRightFloor = Math.floor(OffRightCount);   OffRightFloor = (OffRightFloor >=0) ? OffRightFloor : 0;   OffLeftFloor = (OffLeftFloor >=0) ? OffLeftFloor : 0;   return{      left:OffLeftFloor,      right:OffRightFloor,      center:base.protected.ItemsPerPage   };}I'm looking for any ideas on how to make dragging with larger slide counts less choppy.
Dragable infinite loop carousel, performance issues on dragging large number (25+) of slides
javascript;jquery