Created
June 19, 2014 06:07
-
-
Save muthuishere/2c477d5ebc0afcc429df to your computer and use it in GitHub Desktop.
Jquery plugin to hook css transform
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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