Last active
June 5, 2016 23:08
-
-
Save joe-watkins/062e82917e028195554658f875d1510b to your computer and use it in GitHub Desktop.
Vanilla JS plugin starter
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
var someCoolPlugin = function(options){ | |
// defaults | |
var defaults = { | |
el: ".anchor-to-button", | |
killHref: true, | |
parent: document | |
} | |
// loop through defaults | |
// if the default isn't defined as an option | |
// use default value for option | |
for(var i in defaults){ | |
if(typeof options[i] === "undefined") { | |
options[i] = defaults[i]; | |
} | |
} | |
// ... begin code | |
} // someCoolPlugin | |
var convertedButtons = new someCoolPlugin({ | |
el: ".dropdown-toggle" | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment