diff --git a/angular-sticky-kit.js b/angular-sticky-kit.js index 2c93f3d..2b245cc 100644 --- a/angular-sticky-kit.js +++ b/angular-sticky-kit.js @@ -27,22 +27,40 @@ angular.module("angular-sticky-kit", []) } stickyElement = element.stick_in_parent(options); if (typeof options.stick !== "undefined" && options.stick !== null) { - element.on("sticky_kit:stick", options.stick); + element.on("sticky_kit:stick", function(event) { + var localScope = $(event.target).scope() + localScope.$apply(options.stick) + }); } if (typeof options.unstick !== "undefined" && options.unstick !== null) { - element.on("sticky_kit:unstick", options.unstick); + element.on("sticky_kit:unstick", function(event) { + var localScope = $(event.target).scope() + localScope.$apply(options.unstick) + }); } if (typeof options.bottom !== "undefined" && options.bottom !== null) { - element.on("sticky_kit:bottom", options.bottom); + element.on("sticky_kit:bottom", function(event) { + var localScope = $(event.target).scope() + localScope.$apply(options.bottom) + }); } if (typeof options.unbottom !== "undefined" && options.unbottom !== null) { - element.on("sticky_kit:unbottom", options.unbottom); + element.on("sticky_kit:unbottom", function(event) { + var localScope = $(event.target).scope() + localScope.$apply(options.unbottom) + }); } if (typeof options.recalc !== "undefined" && options.recalc !== null) { - element.on("sticky_kit:recalc", options.recalc); + element.on("sticky_kit:recalc", function(event) { + var localScope = $(event.target).scope() + localScope.$apply(options.recalc) + }); } if (typeof options.detach !== "undefined" && options.detach !== null) { - return element.on("sticky_kit:detach", options.detach); + element.on("sticky_kit:detach", function(event) { + var localScope = $(event.target).scope() + localScope.$apply(options.detach) + }); } } };