JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/themes/base/jquery-ui.css">
<div id="slider"></div>
<div id="swatch" class="ui-widget-content ui-corner-all"></div>
CSS
#swatch {
width: 120px;
height: 100px;
margin-top: 18px;
margin-left: 350px;
background:#000;
}
#slider {
float: left;
clear: left;
width: 300px;
margin: 15px;
}
#slider .ui-slider-range { background: #ef2929; }
#slider .ui-slider-handle { border-color: #ef2929; }
JavaScript
function refreshSwatch() {
var opacity = $("#slider").slider("value")/100;
$("#swatch").css( "opacity", opacity);
}
$(function() {
$('#slider').slider({
orientation: "horizontal",
range: "min",
max: 100,
value: 100,
slide: refreshSwatch,
change: refreshSwatch
});
});