diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2014-03-15 14:52:13 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2014-03-15 14:52:13 -0300 |
commit | ad3bb7b13a75b7a2e23a6be637737ecd11567ed0 (patch) | |
tree | 99844baca10d28199f4257ac9c54b622ddfa7eaf /views/default/magic_topbar/js.php | |
download | elgg-ad3bb7b13a75b7a2e23a6be637737ecd11567ed0.tar.gz elgg-ad3bb7b13a75b7a2e23a6be637737ecd11567ed0.tar.bz2 |
Squashed 'mod/magic_topbar/' content from commit 0fdca8a
git-subtree-dir: mod/magic_topbar
git-subtree-split: 0fdca8adb73fe9e2b5be69c00c15760c8fba3366
Diffstat (limited to 'views/default/magic_topbar/js.php')
-rw-r--r-- | views/default/magic_topbar/js.php | 40 |
1 files changed, 40 insertions, 0 deletions
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}); + }); +}); |