jQuery CSS Clip Animation Plugin
Yesterday I needed to animate the CSS clip property using jQuery.
jQuery.animate() doesn’t support this natively so I went searching for a plugin.
I found exactly what I needed in a simple plugin by Jim Palmer, unfortunately it hasn’t been updated to work with jQuery 1.8.0+.
So here you go, a forked and updated copy of the plugin which will work with jQuery 1.8.0+.
Changes include:
- Support for jQuery 1.8.0+
- Support for the element’s initial clip value to be specified via a stylesheet instead of an inline style
- Support for decimal clip values (thanks to a comment by Manoel Quirino Neto)
- Type checking
fx.endto guard against errors in some scenarios - Support for IE8
The element you are animating must have a clip style specified. Otherwise, usage is as you would expect.