JSFiddle - React, Tailwind, and code Playground
HTML
<input type="range" min="0" max="360" value="45" />
<br />
<p>rotateY(45deg)</p>
<div class="stage">
<div class="outerBox">
<div class="box">45</div>
</div>
</div>
CSS
body {
padding:20px;
}
.outerBox {
transform:rotateY(45deg);
-webkit-transform:rotateY(45deg);
-moz-transform:rotateY(45deg);
-ms-transform:rotateY(45deg);
-o-transform:rotateY(45deg);
height:100px;
width:100px;
margin: 50px 50px;
}
.box {
box-shadow: inset 0 0 15px red, 0px 0px 30px red;
border-radius:4px;
background: linear-gradient(top, rgba(110,110,110,1) 0%,rgba(90,90,90,1) 100%);
background: -webkit-linear-gradient(top, rgba(110,110,110,1) 0%,rgba(90,90,90,1) 100%);
background: -moz-linear-gradient(top, rgba(110,110,110,1) 0%,rgba(90,90,90,1) 100%);
background: -ms-linear-gradient(top, rgba(110,110,110,1) 0%,rgba(90,90,90,1) 100%);
background: -o-linear-gradient(top, rgba(110,110,110,1) 0%,rgba(90,90,90,1) 100%);
line-height:100px;
text-align:center;
color:rgba(220, 220, 220, 1);
text-shadow:-2px -2px rgba(0, 0, 0, .2);
font-size:50px;
transform:rotate(45deg);
-webkit-transform:rotate(45deg);
-moz-transform:rotate(45deg);
-ms-transform:rotate(45deg);
-o-transform:rotate(45deg);
}
JavaScript
var input = $("input");
var box = $(".box");
var outerBox = $(".outerBox");
var cssText = $("p");
input.on("change", function() {
var val = input.val();
box.text(val);
var transformCSS = "rotateY(" + val + "deg)";
outerBox.css({
webkitTransform: transformCSS,
MozTransform: transformCSS,
msTransform: transformCSS,
OTransform: transformCSS
});
cssText.html(transformCSS);
});
/*
html5slider - a JS implementation of <input type=range> for Firefox 4 and up
https://github.com/fryn/html5slider
Copyright (c) 2010-2011 Frank Yan, <http://frankyan.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
(function() {
// test for native support
var test = document.createElement('input');
try {
test.type = 'range';
if (test.type == 'range')
return;
} catch (e) {
return;
}
// test for required property support
if (!document.mozSetImageElement || !('MozAppearance' in test.style))
return;
var scale;
var isMac = navigator.platform ==...