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

1
src/definitions/modules/sticky.js

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

Loading…
Cancel
Save