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.tabs.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.tabs.js')
-rw-r--r-- | website/static/js/foundation3/jquery.foundation.tabs.js | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/website/static/js/foundation3/jquery.foundation.tabs.js b/website/static/js/foundation3/jquery.foundation.tabs.js new file mode 100644 index 0000000..a43967b --- /dev/null +++ b/website/static/js/foundation3/jquery.foundation.tabs.js @@ -0,0 +1,66 @@ +;(function ($, window, document, undefined) { + 'use strict'; + + var settings = { + callback: $.noop, + deep_linking: true, + init: false + }, + + methods = { + init : function (options) { + settings = $.extend({}, settings, options); + + return this.each(function () { + if (!settings.init) methods.events(); + + if (settings.deep_linking) methods.from_hash(); + }); + }, + + events : function () { + $(document).on('click.fndtn', '.tabs a', function (e) { + methods.set_tab($(this).parent('dd, li'), e); + }); + + settings.init = true; + }, + + set_tab : function ($tab, e) { + var $activeTab = $tab.closest('dl, ul').find('.active'), + target = $tab.children('a').attr("href"), + hasHash = /^#/.test(target), + $content = $(target + 'Tab'); + + if (hasHash && $content.length > 0) { + // Show tab content + if (e && !settings.deep_linking) e.preventDefault(); + $content.closest('.tabs-content').children('li').removeClass('active').hide(); + $content.css('display', 'block').addClass('active'); + } + + // Make active tab + $activeTab.removeClass('active'); + $tab.addClass('active'); + + settings.callback(); + }, + + from_hash : function () { + var hash = window.location.hash, + $tab = $('a[href="' + hash + '"]'); + + $tab.trigger('click.fndtn'); + } + } + + $.fn.foundationTabs = function (method) { + if (methods[method]) { + return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); + } else if (typeof method === 'object' || !method) { + return methods.init.apply(this, arguments); + } else { + $.error('Method ' + method + ' does not exist on jQuery.foundationTabs'); + } + }; +}(jQuery, this, this.document)); |