trigger events on update
Dispatch the custom events on `Ps.update`: ``` container.scrollTop = 50; Ps.update(container); ``` This is useful for controlling the scroll position via left/right arrows and enabling/disabling these arrows on scroll or when the start/end is reached. This also allows for the events to be dispatched on page load by calling `Ps.update` right after `Ps.initialise`.
This commit is contained in:
parent
24b34d3dea
commit
7e04a2e72b
@ -6,7 +6,8 @@
|
|||||||
var d = require('../lib/dom')
|
var d = require('../lib/dom')
|
||||||
, h = require('../lib/helper')
|
, h = require('../lib/helper')
|
||||||
, instances = require('./instances')
|
, instances = require('./instances')
|
||||||
, updateGeometry = require('./update-geometry');
|
, updateGeometry = require('./update-geometry')
|
||||||
|
, updateScroll = require('./update-scroll');
|
||||||
|
|
||||||
module.exports = function (element) {
|
module.exports = function (element) {
|
||||||
var i = instances.get(element);
|
var i = instances.get(element);
|
||||||
@ -29,6 +30,10 @@ module.exports = function (element) {
|
|||||||
d.css(i.scrollbarYRail, 'display', 'none');
|
d.css(i.scrollbarYRail, 'display', 'none');
|
||||||
|
|
||||||
updateGeometry(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.scrollbarXRail, 'display', '');
|
||||||
d.css(i.scrollbarYRail, 'display', '');
|
d.css(i.scrollbarYRail, 'display', '');
|
||||||
|
Loading…
Reference in New Issue
Block a user