Skip to content

Instantly share code, notes, and snippets.

@taea
Created January 25, 2013 08:51
Show Gist options
  • Save taea/4632908 to your computer and use it in GitHub Desktop.
Save taea/4632908 to your computer and use it in GitHub Desktop.
$ ->
$.fn.crop = (w, h) ->
$(this).on "load", ->
iw = ($(this).width() - w) / 2
ih = ($(this).height() - h) / 2
$(this).css "top", "-" + ih + "px"
$(this).css "left", "-" + iw + "px"
@taea
Copy link
Author

taea commented Jan 25, 2013

$(".photo").crop 160, 160

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