Added support for carousel animation boundary (left and right)
This commit is contained in:
parent
eca4c3dba0
commit
4ef4767318
|
@ -39,6 +39,10 @@ function dragElement(elmnt, options, onStopDrag) {
|
||||||
pos2 = pos4 - cy;
|
pos2 = pos4 - cy;
|
||||||
pos3 = cx;
|
pos3 = cx;
|
||||||
pos4 = cy;
|
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.top = (elmnt.offsetTop - pos2) + "px";
|
||||||
elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
|
elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
|
||||||
if (options.rotate) {
|
if (options.rotate) {
|
||||||
|
|
|
@ -50,7 +50,12 @@ app.pages.meet = {
|
||||||
setDragEvent: function() {
|
setDragEvent: function() {
|
||||||
const current = app.pages.meet.carousel._elements()[
|
const current = app.pages.meet.carousel._elements()[
|
||||||
app.pages.meet.carousel._current];
|
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 ix = a1[0];
|
||||||
const fx = a2[0];
|
const fx = a2[0];
|
||||||
if (ix > fx) {
|
if (ix > fx) {
|
||||||
|
|
Loading…
Reference in New Issue