diff --git a/src/js/plugin/update-scroll.js b/src/js/plugin/update-scroll.js index ff41ae4..3eab8e8 100644 --- a/src/js/plugin/update-scroll.js +++ b/src/js/plugin/update-scroll.js @@ -56,13 +56,13 @@ module.exports = function (element, axis, value) { var i = instances.get(element); - if (axis === 'top' && value > i.contentHeight - i.containerHeight) { + if (axis === 'top' && value >= i.contentHeight - i.containerHeight) { element.scrollTop = i.contentHeight - i.containerHeight; element.dispatchEvent(yEndEvent); return; // don't allow scroll past container } - if (axis === 'left' && value > i.contentWidth - i.containerWidth) { + if (axis === 'left' && value >= i.contentWidth - i.containerWidth) { element.scrollLeft = i.contentWidth - i.containerWidth; element.dispatchEvent(xEndEvent); return; // don't allow scroll past container diff --git a/src/js/plugin/update.js b/src/js/plugin/update.js index 6d0edfd..3c539ac 100644 --- a/src/js/plugin/update.js +++ b/src/js/plugin/update.js @@ -6,7 +6,8 @@ var d = require('../lib/dom') , h = require('../lib/helper') , instances = require('./instances') - , updateGeometry = require('./update-geometry'); + , updateGeometry = require('./update-geometry') + , updateScroll = require('./update-scroll'); module.exports = function (element) { var i = instances.get(element); @@ -30,6 +31,10 @@ module.exports = function (element) { updateGeometry(element); + // Update top/left scroll to trigger events + updateScroll(element, 'top', element.scrollTop); + updateScroll(element, 'left', element.scrollLeft); + d.css(i.scrollbarXRail, 'display', ''); d.css(i.scrollbarYRail, 'display', ''); };