Skip to content

Instantly share code, notes, and snippets.

@akinov
Last active August 28, 2018 07:43
Show Gist options
  • Save akinov/96c1c5c95460412f9eb29d958ac88a49 to your computer and use it in GitHub Desktop.
Save akinov/96c1c5c95460412f9eb29d958ac88a49 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name rotate img
// @namespace https://gist.github.com/akinov/96c1c5c95460412f9eb29d958ac88a49
// @version 0.1
// @description try to take over the world!
// @author akinov
// @grant none
// @include /\.(jpg|jpeg|png)$/
/* load jQuery */
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
// ==/UserScript==
(function() {
'use strict';
const deg = 90;
let num = 0;
const $toggeBtn = $(`<button>♺</button>`).addClass('btn btn-sm').css({
position: 'fixed',
right: '20px',
top: '120px'
}).on('click', rotate);
$('body').append($toggeBtn);
function rotate() {
num += 1;
$('img').css('transform', 'rotate(' + deg * num + 'deg)');
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment