From 420353a562942a7b4045464cc3981ec18bdabe33 Mon Sep 17 00:00:00 2001 From: timb Date: Fri, 15 Jan 2010 17:33:12 -0800 Subject: added login form to banner --- static/form_login/javascripts/jquery.pop.js | 63 +++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 static/form_login/javascripts/jquery.pop.js (limited to 'static/form_login/javascripts/jquery.pop.js') diff --git a/static/form_login/javascripts/jquery.pop.js b/static/form_login/javascripts/jquery.pop.js new file mode 100644 index 0000000..c53d4e3 --- /dev/null +++ b/static/form_login/javascripts/jquery.pop.js @@ -0,0 +1,63 @@ +// +// pop! for jQuery +// v0.2 requires jQuery v1.2 or later +// +// Licensed under the MIT: +// http://www.opensource.org/licenses/mit-license.php +// +// Copyright 2007,2008 SEAOFCLOUDS [http://seaofclouds.com] +// + +(function($) { + + $.pop = function(options){ + + // settings + var settings = { + pop_class : '.pop', + pop_toggle_text : '' + } + + // inject html wrapper + function initpops (){ + $(settings.pop_class).each(function() { + var pop_classes = $(this).attr("class"); + $(this).addClass("pop_menu"); + $(this).wrap("
"); + $(".pop_menu").attr("class", "pop_menu"); + $(this).before(" \ +
"+settings.pop_toggle_text+"
\ + "); + }); + } + initpops(); + + // assign reverse z-indexes to each pop + var totalpops = $(settings.pop_class).size() + 1000; + $(settings.pop_class).each(function(i) { + var popzindex = totalpops - i; + $(this).css({ zIndex: popzindex }); + }); + // close pops if user clicks outside of pop + activePop = null; + function closeInactivePop() { + $(settings.pop_class).each(function (i) { + if ($(this).hasClass('active') && i!=activePop) { + $(this).removeClass('active'); + } + }); + return false; + } + $(settings.pop_class).mouseover(function() { activePop = $(settings.pop_class).index(this); }); + $(settings.pop_class).mouseout(function() { activePop = null; }); + + $(document.body).click(function(){ + closeInactivePop(); + }); + // toggle that pop + $(".pop_toggle").click(function(){ + $(this).parent(settings.pop_class).toggleClass("active"); + }); + } + +})(jQuery); \ No newline at end of file -- cgit v1.2.3-70-g09d2