Skip to content

Instantly share code, notes, and snippets.

@yayMark
Created September 6, 2018 07:19
Show Gist options
  • Save yayMark/ace4082acd65b491b1ba11e4e938ff33 to your computer and use it in GitHub Desktop.
Save yayMark/ace4082acd65b491b1ba11e4e938ff33 to your computer and use it in GitHub Desktop.
Put a border on a jQuery element or two
(function ($) {
$.fn.outline = function(options) {
var settings = $.extend({
borderWidth: "1px",
borderStyle: "solid",
borderColor: "red"
}, options);
return this.css({
borderWidth: settings.borderWidth,
borderStyle: settings.borderStyle,
borderColor: settings.borderColor
});
};
}(jQuery));
@yayMark
Copy link
Author

yayMark commented Sep 6, 2018

Usage:

elements.outline();
elements.outline({borderColor: "green"});
elements.outline({borderWidth: "10px", borderStyle: "dashed", borderColor: "hotpink"}); // although that's just silly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment