Last active
August 28, 2018 07:43
-
-
Save akinov/96c1c5c95460412f9eb29d958ac88a49 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// ==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