diff options
-rw-r--r-- | manifest.xml | 16 | ||||
-rw-r--r-- | start.php | 16 | ||||
-rw-r--r-- | views/default/magic_topbar/css.php | 18 | ||||
-rw-r--r-- | views/default/magic_topbar/js.php | 40 |
4 files changed, 90 insertions, 0 deletions
diff --git a/manifest.xml b/manifest.xml new file mode 100644 index 000000000..4ce8e37a4 --- /dev/null +++ b/manifest.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plugin_manifest xmlns="http://www.elgg.org/plugin_manifest/1.8"> + <name>Magic Topbar</name> + <author>Lorea developers</author> + <version>0.2.1</version> + <category>bundled</category> + <description>This plugin shows topbar all time, improving usability.</description> + <website>https://lorea.cc/</website> + <copyright>(C) Lorea 2011</copyright> + <license>GNU General Public License version 2</license> + <requires> + <type>elgg_release</type> + <version>1.8</version> + </requires> + <activate_on_install>true</activate_on_install> +</plugin_manifest> diff --git a/start.php b/start.php new file mode 100644 index 000000000..36babf170 --- /dev/null +++ b/start.php @@ -0,0 +1,16 @@ +<?php +/** + * Elgg Magic Topbar plugin + * + * @package ElggMagicTopbar + */ + +elgg_register_event_handler('init', 'system', 'magic_topbar_init'); + +/** + * Initialize the magic topbar plugin. + */ +function magic_topbar_init() { + elgg_extend_view('css/elgg','magic_topbar/css'); + elgg_extend_view('js/elgg','magic_topbar/js'); +} diff --git a/views/default/magic_topbar/css.php b/views/default/magic_topbar/css.php new file mode 100644 index 000000000..718c09bd0 --- /dev/null +++ b/views/default/magic_topbar/css.php @@ -0,0 +1,18 @@ +<?php +/** + * Magic Topbar CSS + * + * @package ElggMagicTopbar +*/ +?> + +/* Magic Topbar Plugin */ + +.elgg-page-topbar{ + position: fixed; + width:100%; +} +.elgg-page-header { + margin-top: 0px; + padding-top: 24px; +} diff --git a/views/default/magic_topbar/js.php b/views/default/magic_topbar/js.php new file mode 100644 index 000000000..cb51913f3 --- /dev/null +++ b/views/default/magic_topbar/js.php @@ -0,0 +1,40 @@ +<?php +/** + * Hide the topbar when no using with an animation. + * + * @package ElggMagicTopbar + */ +?> + +$(function() { + + var $topbar = $(".elgg-page-topbar"), + $window = $(window); + + $topbar.css({position: 'fixed', width: '100%'}); + + $window.scroll(function() { + $topbar.stop(); + var opacity; + if ($window.scrollTop() > 14) { + $topbar.animate({opacity: 0}, 'fast'); + } else { + $topbar.css({opacity: 1}); + } + }); + + $topbar.mouseenter(function(){ + $topbar.stop(); + $topbar.animate({opacity: 1}); + }) + .mouseleave(function(){ + $topbar.stop(); + var opacity; + if ($window.scrollTop() > 14) { + opacity = 0; + } else { + opacity = 1; + } + $topbar.animate({opacity: opacity}); + }); +}); |