angular.module('EssayApp.directives').directive "stickInParent", ['$timeout', ($timeout) -> restrict: 'A' scope: true link: (scope, element, attrs) -> defaults = { } options = scope.$eval(attrs.stickInParent) || {} options = $.extend defaults, options initSticky = -> return if options.parent? && $(options.parent).length is 0 element.stick_in_parent(options) $timeout initSticky, 10, false ]