Browse Source

Add onUpdate callback to visibility, fix event handlers

pull/1785/merge
jlukic 9 years ago
parent
commit
4fe0ae0760
2 changed files with 10 additions and 0 deletions
  1. 9
      src/definitions/behaviors/visibility.js
  2. 1
      src/definitions/modules/sticky.js

9
src/definitions/behaviors/visibility.js

@ -98,6 +98,8 @@ $.fn.visibility = function(parameters) {
.off(eventNamespace)
.removeData(moduleNamespace)
;
$window.off('resize' + eventNamespace, module.event.refresh);
$context.off('scroll' + eventNamespace, module.event.scroll);
},
observeChanges: function() {
@ -313,6 +315,12 @@ $.fn.visibility = function(parameters) {
module.bottomVisible();
module.topPassed();
module.bottomPassed();
// on update callback
if(settings.onUpdate) {
settings.onUpdate.call(element, module.get.elementCalculations());
}
}
},
@ -1003,6 +1011,7 @@ $.fn.visibility.settings = {
onBottomPassedReverse : false,
// utility callbacks
onUpdate : false, // disabled by default for performance
onRefresh : function(){},
onScroll : function(){},

1
src/definitions/modules/sticky.js

@ -743,6 +743,7 @@ $.fn.sticky.settings = {
pushing : false,
context : false,
scrollContext : window,
offset : 0,
bottomOffset : 0,

Loading…
Cancel
Save