Skip to content

Instantly share code, notes, and snippets.

View aklump's full-sized avatar

Aaron Klump aklump

View GitHub Profile
@aklump
aklump / font-size
Last active October 6, 2015 03:07
Output font-size in rem with px fallback
/**
* Output font-size (and line-height) in rem with px fallback
*
* After declaring a font-size of 100% on the html tag, you should use the
@font_size for all other font-size declarations.
*
* @code
* html {
* font: 100%/1.4 "Times New Roman", Times, Serif normal;
* }
@aklump
aklump / jquery.viewport_class.js
Last active October 6, 2015 07:57
jQuery plugin to apply current viewport to a DOM element and fire a callback function when viewport changes.
This gist has moved: http://www.intheloftstudios.com/packages/jquery/jquery.viewport_class
@aklump
aklump / jquery.equal_heights.js
Last active October 11, 2018 14:35
jQuery plugin to apply equal heights to children of a DOM element, with filters and targets.
/**
* Equal Heights Plugin
* Equalize the heights of all child elements to the tallest child
*
* @param object options
* - filter: An optional selector string to filter which children are considered.
* - not: An optional selector string to filter which children are NOT considered.
* - target: Additional selector of targets where height will be applied; these nodes
will not be used to calculate height, but will ONLY receive the calculated
height.
@aklump
aklump / drupal.arg.js
Last active July 12, 2016 20:05
Add Drupal.arg() for parsing urls in Drupal
/**
* Adds method arg to the Drupal object for grabbing url args
*
* @author Aaron Klump, In the Loft Studios, LLC
* @see http://www.intheloftstudios.com
* @see http://gist.github.com/3078482
*
* For use in a theme or module add the following to your .info file
* @code
* scripts[] = [path to js dir]/drupal.arg.js
@aklump
aklump / jquery.scrolling_anchors.js
Last active October 20, 2015 17:59
jQuery plugin to convert your anchors to scrolling anchors
/**
* Smooth scroll to anchors
*
* Looks first for a dom with id of the href fragment of the link; then it looks
for an dom element by name=fragment
*
* @param function callback
* onClick callback function receives two params jQuery objects: link, target
* @param object options
* - distance: int
@aklump
aklump / jquery.loft_labels.js
Last active October 7, 2015 09:58
jQuery plugin to move form labels into the textfield
This has moved to http://www.intheloftstudios.com/packages/jquery/jquery.loft_labels
@aklump
aklump / jquery.fapi_widths.js
Last active October 8, 2015 04:18
jQuery plugin to equalize form element widths
/**
* Form Element Width Equalizer Plugin (Optimized for Drupal FAPI)
*
* Adjusts the widths of child elements to a set pixel dimension.
*
* Makes all text fields and text areas (or other as specified in
* options.elements) equal widths by subracting the css properties of: margin,
* border and padding from each element.
*
* If width is omitted then all elements will have their width matched to $(this)
@aklump
aklump / jquery.running_clock.js
Last active October 10, 2015 22:17
jQuery plugin to append a running clock to an element
This has been moved to http://www.intheloftstudios.com/packages/jquery/jquery.running_clock
@aklump
aklump / jquery.drupal_check_all.js
Created December 11, 2012 19:59
Adds a Check All Option to a group of Checkboxes in Drupal jQuery Plugin
/**
* Adds a Check All Option to a group of Checkboxes in Drupal jQuery Plugin
*
* To make this work you need pass to this function, a div that is a decendent
of a form and an ancestor of multiple checkboxes. It is specifically tuned to
drupal, but can be used for any html by setting the options. Here's and
example, where .form-item-list is fapi element of type checkboxes.
*
* @code
* $('#my-form .form-item-list').drupalCheckAll();
@aklump
aklump / jquery.list_search_filter.js
Last active October 14, 2015 00:18
Create a searchable list by textfield jQuery Plugin
/**
* Create a searchable list by textfield jQuery Plugin
*
* @param object $input
* A jQuery object of a textfield to use as the search box
* @param options
* code: the ascii code of the key to use for lookup; when this is pressed
the list will be searched, defaults to 13 for the Return key.
* auto: min length needed before it will autosearch, for large lists
setting this too low results in poor performance. Set this to 0 to turn off