Added support for carousel animation boundary (left and right)

This commit is contained in:
Niko 2022-02-14 15:53:26 +01:00
parent eca4c3dba0
commit 4ef4767318
2 changed files with 10 additions and 1 deletions

View File

@ -39,6 +39,10 @@ function dragElement(elmnt, options, onStopDrag) {
pos2 = pos4 - cy;
pos3 = cx;
pos4 = cy;
if (options.right !== undefined && options.right === false)
if (pos1 < 0) return;
if (options.left !== undefined && options.left === false)
if (pos1 > 0) return;
elmnt.style.top = (elmnt.offsetTop - pos2) + "px";
elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
if (options.rotate) {

View File

@ -50,7 +50,12 @@ app.pages.meet = {
setDragEvent: function() {
const current = app.pages.meet.carousel._elements()[
app.pages.meet.carousel._current];
dragElement(current, { y: false, return2start: true }, function(a1, a2) {
var options = { y: false, return2start: true };
if (!app.carousel.hasPrev(app.pages.meet.carousel))
options.right = false;
if (!app.carousel.hasNext(app.pages.meet.carousel))
options.left = false;
dragElement(current, options, function(a1, a2) {
const ix = a1[0];
const fx = a2[0];
if (ix > fx) {