Skip to content

Instantly share code, notes, and snippets.

@jethrolarson
Created May 12, 2010 00:29
Show Gist options
  • Save jethrolarson/398059 to your computer and use it in GitHub Desktop.
Save jethrolarson/398059 to your computer and use it in GitHub Desktop.
jQuery.fn.balls = function(){
return this.each(function(){
var $this = $(this),
w = $this.width(),
h = $this.height(),
max = w > h ? w : h,
rad = Math.floor(max/2) + "px";
$this.css({
"width": max,
"height": max,
"-moz-border-radius": rad,
"-webkit-border-radius": rad,
"border-radius": rad,
"overflow":"hidden"
});
});
};
@jethrolarson
Copy link
Author

Someone at the office insisted that a balls plugin needed to get made. Well here you go.

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