From 88e1f02c1a250dae7b8dabeeaf9f6209f4c84942 Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Tue, 26 May 2009 03:59:35 +0000 Subject: Split out re-used JavaScript for common functions (messages, valign), panel toggle, and forms to external files. --- lib/gallery.common.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 lib/gallery.common.js (limited to 'lib/gallery.common.js') diff --git a/lib/gallery.common.js b/lib/gallery.common.js new file mode 100644 index 00000000..bb2e75a2 --- /dev/null +++ b/lib/gallery.common.js @@ -0,0 +1,30 @@ +/** + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +(function () { + $.fn.showMessage = function(message) { + return this.each(function(i){ + $(this).effect("highlight", {"color": "white"}, 3000); + $(this).animate({opacity: 1.0}, 6000); + $(this).fadeOut("slow"); + }); + }; +})(jQuery); + +// Vertically align a block element's content +(function () { + $.fn.vAlign = function(container) { + return this.each(function(i){ + if (container == null) { + container = 'div'; + } + $(this).html("<" + container + ">" + $(this).html() + ""); + var el = $(this).children(container + ":first"); + var elh = $(el).height(); + var ph = $(this).height(); + var nh = (ph - elh) / 2; + $(el).css('margin-top', nh); + }); + }; +})(jQuery); -- cgit v1.2.3