Created
April 13, 2011 13:42
-
-
Save gregorymostizky/917562 to your computer and use it in GitHub Desktop.
Adding custom function to JQuery
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
// definition | |
$.fn.customFunction = function(options) { | |
var defaults = { | |
width: 650, | |
height: 450 | |
}; | |
var opts = $.extend(defaults, options); | |
var self = $(this[0]); // if working on first/single element | |
// functionality here | |
self.css('color','red'); | |
} | |
// usage | |
$('#mydiv').customFunction({color:'green'}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment