summaryrefslogtreecommitdiffstats
path: root/js-old/directive/NewsStickyMenu.js
diff options
context:
space:
mode:
Diffstat (limited to 'js-old/directive/NewsStickyMenu.js')
-rw-r--r--js-old/directive/NewsStickyMenu.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/js-old/directive/NewsStickyMenu.js b/js-old/directive/NewsStickyMenu.js
new file mode 100644
index 000000000..b46500577
--- /dev/null
+++ b/js-old/directive/NewsStickyMenu.js
@@ -0,0 +1,27 @@
+/**
+ * Nextcloud - News
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright Bernhard Posselt 2014
+ */
+app.directive('newsStickyMenu', function () {
+ 'use strict';
+
+ return function (scope, elem, attr) {
+ var height = 40;
+
+ $(attr.newsStickyMenu).scroll(function () {
+ var scrollHeight = $(this).scrollTop();
+
+ if (scrollHeight > height) {
+ elem.addClass('fixed');
+ elem.css('top', scrollHeight);
+ } else {
+ elem.removeClass('fixed');
+ }
+ });
+ };
+}); \ No newline at end of file