Created
November 15, 2012 10:09
-
-
Save byrichardpowell/4077810 to your computer and use it in GitHub Desktop.
jQuery Or
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Setup global objects | |
window.SITE = {} | |
window.SITE.decoration = {}; | |
// Setup the decoration method | |
SITE.decoration.selects = function( $wrapper ) { | |
// Search within the wrapper | |
// Or search wihin the body if $wrapper is undefined | |
$wrapper.or().find('select').chosen(); | |
} | |
// Decorate the select once | |
// the document is ready | |
$(document).ready( function() { | |
// Decorate the selects when | |
// the document is ready | |
SITE.decoration.selects(); | |
// Later on: | |
// After part of the page has changed | |
// and may contain a select that needs decorating | |
SITE.decoration.selects( $('#updated-wrapper') ); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment