Last active
August 29, 2015 14:21
-
-
Save obiPlabon/ec36586c1ecfbf2f8d1b to your computer and use it in GitHub Desktop.
Initialize plugin based on its existence
This file contains hidden or 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
// 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