From 32bdd1443af2e3c7c5431c539d64f2e0a70a3d34 Mon Sep 17 00:00:00 2001 From: nicholaswhite656 Date: Fri, 13 Nov 2015 15:24:57 -0700 Subject: [PATCH] feature: easing can be configured by number --- demo/examples.htm | 3 ++- src/jquery.ez-plus.js | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/demo/examples.htm b/demo/examples.htm index 2e47343..d0918c4 100644 --- a/demo/examples.htm +++ b/demo/examples.htm @@ -658,7 +658,7 @@

Easing

You can use the default easing or a custom easing setting. - The amount of easing can also be altered - default is 12, set higher for more, lower for + The amount of easing can also be altered - default is 16, set higher for more, lower for less

@@ -670,6 +670,7 @@

Easing

$(document).ready(function () { $("#zoom_10").ezPlus({ easing: true + // true is the same as 16; try 5 or 20 }); }); diff --git a/src/jquery.ez-plus.js b/src/jquery.ez-plus.js index 14a3a18..5eec064 100644 --- a/src/jquery.ez-plus.js +++ b/src/jquery.ez-plus.js @@ -1095,6 +1095,10 @@ if (typeof Object.create !== 'function') { if (!self.yp) { self.yp = 0; } + var interval = 16; + if (Number.isInteger(parseInt(self.options.easing))){ + interval = parseInt(self.options.easing); + } //if loop not already started, then run it if (!self.loop) { self.loop = setInterval(function () { @@ -1190,7 +1194,7 @@ if (typeof Object.create !== 'function') { self.zoomWindow.css('background-position', self.xp + 'px ' + self.yp + 'px'); } - }, 16); + }, interval); } } else {