/* SVN FILE: $Id: SNIPPETS.txt 30 2008-07-21 18:24:51Z jleveille $ */ /** * Snippets of javascript code for quick copy/paste * * BluePlate - BlueAtlas base template files * Copyright 2008 - Present, * 19508 Amaranth Dr., Suite D, Germantown, Maryland 20874 | 301.540.5950 * * Redistributions of files must retain the above notice. * * @filesource * @copyright Copyright 2008 - Present, Blue Atlas Interactive * @version $Rev: 30 $ * @modifiedby $LastChangedBy: jleveille $ * @lastmodified $Date: 2008-07-21 14:24:51 -0400 (Mon, 21 Jul 2008) $ */ /****** JQuery Snippets /****** // Alternating Rows $("table tbody tr:even").addClass("even"); $("table tbody tr:odd").addClass("odd"); // Specifying file types // ^= begins with, $= ends with, *= contains $("a[@href$=.pdf]").addClass("pdf"); $("a[@href$=.doc]").addClass("word"); $("a[@href$=.xls]").addClass("excel"); // Microformat Considerations $("#feature a[href^=http://]").attr("rel","external"); // An Opera Mini Effect // http://kilianvalkhof.com/2008/css-xhtml/context-hover-adding-context-feedback-to-your-links/ $("a").hover( function() {$("[href="+$(this).attr("href")+"]").addClass("hover").filter(this/*':first'*/).css("background-color","none");}, function() {$("[href="+$(this).attr("href")+"]").removeClass("hover");} ); // Search Field Value toggle $("#searchField input[type=text]").focus(function(){$("#searchField input").val("");}); $("#searchField input[type=text]").blur(function(){$("#searchField input").val("Search for it");}); // Click Handler $('a').click(function () { //do something return false; });