Skip to content

Instantly share code, notes, and snippets.

@muthuishere
Created June 19, 2014 06:07
Show Gist options
  • Save muthuishere/2c477d5ebc0afcc429df to your computer and use it in GitHub Desktop.
Save muthuishere/2c477d5ebc0afcc429df to your computer and use it in GitHub Desktop.
Jquery plugin to hook css transform
(function( $ ) {
// First, check to see if cssHooks are supported
if ( !$.cssHooks ) {
// If not, output an error message
throw( new Error( "jQuery 1.4.3 or above is required for this plugin to work" ) );
}
// Wrap in a document ready call, because jQuery writes
// cssHooks at this time and will blow away your functions
// if they exist.
$(function () {
$.cssHooks[ "transform" ] = {
get: function( elem, computed, extra ) {
// Handle getting the CSS property
return $.css( elem, "transform" );
},
set: function( elem, value ) {
// Handle setting the CSS value
elem.style[ "transform" ] = value;
elem.style[ "-ms-transform" ] = value;
elem.style[ "-webkit-transform" ] = value;
// console.log("elem: "+elem);
}
};
});
})( jQuery );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment