Skip to content

Instantly share code, notes, and snippets.

@obiPlabon
Last active August 29, 2015 14:21
Show Gist options
  • Save obiPlabon/ec36586c1ecfbf2f8d1b to your computer and use it in GitHub Desktop.
Save obiPlabon/ec36586c1ecfbf2f8d1b to your computer and use it in GitHub Desktop.
Initialize plugin based on its existence
// Initialize plugin based on its existence
//
// if ( $.isFunction( $.fn.pluginMethodName ) )
// $(selector).pluginMethodName();
//
// Note: you can ommit the $.isFunction
// simply write
// if ( $.fn.pluginMethodName )
// Example
if ( $.isFunction( $.fn.equalHeights ) )
$('.eq-box').equalHeights();
// Shortcut Example
if ( $.fn.equalHeights )
$('.eq-box').equalHeights();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment