diff options
author | Jayaram Pai | 2013-11-19 17:51:06 +0530 |
---|---|---|
committer | Jayaram Pai | 2013-11-19 17:51:06 +0530 |
commit | 9c50efc99b64350c66c92321b7f9d565e4da611c (patch) | |
tree | a92522f904b41ac9fba070a5c71cc9ee3b85286b /website/static/js/foundation3/jquery.foundation.navigation.js | |
parent | 36228d2bc0d1301775ded964a3fa67f2e844a126 (diff) | |
download | SciPy2013-9c50efc99b64350c66c92321b7f9d565e4da611c.tar.gz SciPy2013-9c50efc99b64350c66c92321b7f9d565e4da611c.tar.bz2 SciPy2013-9c50efc99b64350c66c92321b7f9d565e4da611c.zip |
testing ie8 index
Diffstat (limited to 'website/static/js/foundation3/jquery.foundation.navigation.js')
-rw-r--r-- | website/static/js/foundation3/jquery.foundation.navigation.js | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/website/static/js/foundation3/jquery.foundation.navigation.js b/website/static/js/foundation3/jquery.foundation.navigation.js new file mode 100644 index 0000000..0684b65 --- /dev/null +++ b/website/static/js/foundation3/jquery.foundation.navigation.js @@ -0,0 +1,55 @@ +;(function ($, window, undefined) { + 'use strict'; + + $.fn.foundationNavigation = function (options) { + + var lockNavBar = false; + // Windows Phone, sadly, does not register touch events :( + if (Modernizr.touch || navigator.userAgent.match(/Windows Phone/i)) { + $(document).on('click.fndtn touchstart.fndtn', '.nav-bar a.flyout-toggle', function (e) { + e.preventDefault(); + var flyout = $(this).siblings('.flyout').first(); + if (lockNavBar === false) { + $('.nav-bar .flyout').not(flyout).slideUp(500); + flyout.slideToggle(500, function () { + lockNavBar = false; + }); + } + lockNavBar = true; + }); + $('.nav-bar>li.has-flyout', this).addClass('is-touch'); + } else { + $('.nav-bar>li.has-flyout', this).on('mouseenter mouseleave', function (e) { + if (e.type == 'mouseenter') { + $('.nav-bar').find('.flyout').hide(); + $(this).children('.flyout').show(); + } + + if (e.type == 'mouseleave') { + var flyout = $(this).children('.flyout'), + inputs = flyout.find('input'), + hasFocus = function (inputs) { + var focus; + if (inputs.length > 0) { + inputs.each(function () { + if ($(this).is(":focus")) { + focus = true; + } + }); + return focus; + } + + return false; + }; + + if (!hasFocus(inputs)) { + $(this).children('.flyout').hide(); + } + } + + }); + } + + }; + +})( jQuery, this ); |