xpull
xpull copied to clipboard
Adding events for pull threshold
If you want some events to happen when the pull threshold is exceeded (or reversed) - Here is some code.
I know I should do a pull request - but for now, if you want to patch this in go ahead
We are using this to trigger a slight vibration on a mobile device when the threshold is exceeded.
`--- a/www/js/libraries/xpull.js +++ b/www/js/libraries/xpull.js @@ -47,6 +47,8 @@ scrollingDom: null, // if null, specified element onPullStart: function() {}, onPullEnd: function() {},
-
onPullThreshold: function() {}, -
onPullThresholdReverse: function() {}, callback: function() {} };
@@ -126,8 +128,10 @@
if (top > that.options.pullThreshold && !hasc) {
that.indicator.addClass('xpull_pulled');
-
that.options.onPullThreshold.call(this); } else if (top <= that.options.pullThreshold && hasc) { that.indicator.removeClass('xpull_pulled'); -
that.options.onPullThresholdReverse.call(this); } } else {
`