JQuery Click Event
JQuery Click Event
HTML
<img src="http://www.entertainmentayr.com/joey_Lawrence_files/entertayr%20gold%20record%20LP%20logo%20small%20.png" id="btn">
JavaScript
$(document).ready(function () {
$('#btn').click(function () {
$(this).stop(true, true).rotate({
count: 1,
forceJS: true
});
});
});
/*
jQuery-Rotate-Plugin v0.2 by anatol.at
http://jsfiddle.net/Anatol/T6kDR/
*/
$.fn.rotate = function (options) {
var $this = $(this),
prefixes, opts, wait4css = 0;
prefixes = ['-Webkit-', '-Moz-', '-O-', '-ms-', ''];
opts = $.extend({
startDeg: false,
endDeg: 360,
duration: 1,
count: 1,
easing: 'linear',
animate: {},
forceJS: false
}, options);
function supports(prop) {
var can = false,
style = document.createElement('div').style;
$.each(prefixes, function (i, prefix) {
if (style[prefix.replace(/\-/g, '') + prop] === '') {
can = true;
}
});
return can;
}
function prefixed(prop, value) {
var css = {};
if (!supports.transform) {
return css;
}
$.each(prefixes, function (i, prefix) {
css[prefix.toLowerCase() + prop] = value || '';
});
return css;
}
function generateFilter(deg) {
var rot, cos, sin, matrix;
if (supports.transform) {
return '';
}
rot = deg >= 0 ? Math.PI * deg / 180 : Math.PI * (360 + deg) / 180;
cos = Math.cos(rot);
sin = Math.sin(rot);
matrix = 'M11=' + cos + ',M12=' + (-sin) + ',M21=' + sin + ',M22=' + cos + ',SizingMethod="auto expand"';
return 'progid:DXImageTransform.Microsoft.Matrix(' + matrix + ')';
}
supports.transform = supports('Transform');
supports.transition = supports('Transition');
opts.endDeg *= opts.count;
opts.duration *= opts.count;
if (supports.transition && !opts.forceJS) { // CSS-Transition
if ((/Firefox/).test(navigator.userAgent)) {
wait4css = (!options || !options.animate)...