Skip to content

Instantly share code, notes, and snippets.

View cwardzala's full-sized avatar
🏠
Working from home

Cameron Wardzala cwardzala

🏠
Working from home
View GitHub Profile
@cwardzala
cwardzala / preventclicks.js
Created January 18, 2012 18:07
prevent clicks
var preventClick = function (event) {
event.preventDefault();
event.stopPropagation();
return false;
};
if (isMobile === true) {
   $('.post-attribution a').click(preventClick);
}
@cwardzala
cwardzala / placeholder.js
Created November 15, 2011 00:16
HTML5 Placeholder fallback.
function hasPlaceholderSupport() {
var input = document.createElement('input');
return ('placeholder' in input);
}
(function () {
if (hasPlaceholderSupport() === false) {
$('input[placeholder]').each(function () {
var $this = $(this), placeholder = $this.attr('placeholder');
$this.val(placeholder).focus(function() {
@cwardzala
cwardzala / responsive-nav.css
Created October 17, 2011 20:00
Responsive Nav
/* Adapted from http://bostonglobe.com */
nav ul {display:table; width:100%; border:solid 1px #ddd; border-collapse:collapse; margin:0 0 30px; padding:0; background:whiteSmoke;}
nav ul li {display:table-cell; text-align:center; margin:0;}
nav ul li a {display:block; padding:10px 0; text-decoration:none;}
nav ul li a:hover {background:#333; color:#eee;}
/* fixes for IE7 :(
widths have to be set to percentage of number of items based on total width
formula: ((totalwidth/# of items)*100)/totalwidth = li width %
example: ((960/4)*100)/960 = 25%
@cwardzala
cwardzala / toggleText-jquery.js
Created August 18, 2011 21:07
toggleText plugin for jQuery
/**
* textToggle jQuery Plugin
* Written By: Cameron Wardzala
*
* Usage: $(selector).textToggle('foo','bar');
*/
jQuery.fn.toggleText = function (a,b) {
return this.each(function () {
var $t = $(this);