Skip to content

Instantly share code, notes, and snippets.

@wyattdanger
Created August 22, 2011 20:02
Show Gist options
  • Save wyattdanger/1163371 to your computer and use it in GitHub Desktop.
Save wyattdanger/1163371 to your computer and use it in GitHub Desktop.
Poppa
/* Before Big Poppa */
if ( $('ul.tabs').size() ) {
// do stuff
}
if ( $('a[href^=http]').size() ) {
// do stuff
}
if ( $('#fancy-page').size() ) {
// do stuff like require(['fancy-page-script.js']);
}
/* After Big Poppa */
$.poppa({
'a[href^=http]': function (a) {
// do something with each external anchor in the DOM,
// jQuery object $('a[href^=http]') available locally as a
},
'ul.tabs': function (ul) {
// do something with each ul.tabs
// jQuery object of $('ul.tabs') available locally as ul
},
'#fancy-page': function () {
// do stuff like require(['fancy-page-script.js']);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment