(function($) {
$.fn.gwpSlider = function(options) {
const settings = $.extend({
PerView: 1,
margin: 10,
auto: false,
autoTime: 10000,
pagination: true,
navigation: true
}, options);

return this.each(function() {
// ...
// kodunu buraya gir
// ...
const handleStart = (e) => {
if (e.type === 'touchstart') e.preventDefault();
isDragging = true;
startPos = getPosX(e);
carousel.classList.add('grabbing');
animationID = requestAnimationFrame(updateCarouselPosition);
};

const handleEnd = () => {
if (!isDragging) return;
isDragging = false;
cancelAnimationFrame(animationID);
const movedBy = currentTranslate - prevTranslate;

if (movedBy < -100 && currentIndex < carousel.children.length - settings.perView) currentIndex++;
if (movedBy > 100 && currentIndex > 0) currentIndex--;

setPositionByIndex();
carousel.classList.remove('grabbing');
};

const handleMove = (e) => {
if (!isDragging) return;
currentTranslate = prevTranslate + getPosX(e) - startPos;
cancelAnimationFrame(animationID);
animationID = requestAnimationFrame(updateCarouselPosition);
};

const getPosX = (e) => e.type.includes('mouse') ? e.pageX : e.touches[0].clientX;
['mousedown', 'touchstart'].forEach(evt =>
carousel.addEventListener(evt, handleStart)
);

['mouseup', 'touchend'].forEach(evt =>
document.addEventListener(evt, handleEnd)
);

['mousemove', 'touchmove'].forEach(evt =>
document.addEventListener(evt, handleMove)
);
});
};
})(jQuery);