<link id="link" rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/themes/black-tie/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/jquery-ui.min.js"></script>
<style type="text/css">
#target {
width: 400px!important;
height: 100px;
border: solid 1px #000000; /* 罫線 */
margin: 50px 0 0 50px; /* 上と左の余白 */
}
#slider1x,#slider1y,#slider2, #slider3 {
width: 200px;
margin: 0 0 0 20px;
}
#tbl td{
padding: 5px;
}
#result {
width: 400px;
}
</style>
<table id="tbl">
<tr><td>影の位置(x)</td><td><div id="slider1x"></div></td><td>box-shadow: <b style='color:#F00'>99px</b> 99px 99px 99px;</td></tr>
<tr><td>影の位置(y)</td><td><div id="slider1y"></div></td><td>box-shadow: 99px <b style='color:#F00'>99px</b> 99px 99px;</td></tr>
<tr><td>ぼかし距離</td><td><div id="slider2"></div></td><td>box-shadow: 99px 99px <b style='color:#F00'>99px</b> 99px;</td></tr>
<tr><td>広がり</td><td><div id="slider3"></div></td><td>box-shadow: 99px 99px 99px <b style='color:#F00'>99px</b>;</td></tr>
<tr><td>inset <input type="checkbox" id="inset"/></td><td></td><td></td></tr>
<tr><td colspan="3"><input id="result"></td></tr>
</table>
<div id="target"></div>
<script type="text/javascript">
var p1x = "0px";
var p1y = "0px";
var p2 = "0px";
var p3 = "0px";
var pw = "";
$("#target").css("box-shadow", p1x+" "+p1y+" "+p2+" "+p3+pw);
$("#result").val( "box-shadow: "+p1x+" "+p1y+" "+p2+" "+p3+pw )
$("#inset").change(function() {
if ( $("#inset").prop('checked') ) {
pw = " inset";
}
else {
pw = "";
}
$("#target").css("box-shadow", p1x+" "+p1y+" "+p2+" "+p3+pw);
$("#result").val( "box-shadow: "+p1x+" "+p1y+" "+p2+" "+p3+pw )
});
$(function () {
$("#slider1x").slider({
range: "min",
step: 1,
min: -50,
max: 50,
value: 0,
slide: function (event, ui) {
p1x = ui.value+"px";
$("#target").css("box-shadow", p1x+" "+p1y+" "+p2+" "+p3+pw);
$("#result").val( "box-shadow: "+p1x+" "+p1y+" "+p2+" "+p3+pw )
}
});
});
$(function () {
$("#slider1y").slider({
range: "min",
step: 1,
min: -50,
max: 50,
value: 0,
slide: function (event, ui) {
p1y = ui.value+"px";
$("#target").css("box-shadow", p1x+" "+p1y+" "+p2+" "+p3+pw);
$("#result").val( "box-shadow: "+p1x+" "+p1y+" "+p2+" "+p3+pw )
}
});
});
$(function () {
$("#slider2").slider({
range: "min",
step: 1,
min: 0,
max: 50,
value: 0,
slide: function (event, ui) {
p2 = ui.value+"px";
$("#target").css("box-shadow", p1x+" "+p1y+" "+p2+" "+p3+pw);
$("#result").val( "box-shadow: "+p1x+" "+p1y+" "+p2+" "+p3+pw )
}
});
});
$(function () {
$("#slider3").slider({
range: "min",
step: 1,
min: -50,
max: 50,
value: 0,
slide: function (event, ui) {
p3 = ui.value+"px";
$("#target").css("box-shadow", p1x+" "+p1y+" "+p2+" "+p3+pw);
$("#result").val( "box-shadow: "+p1x+" "+p1y+" "+p2+" "+p3+pw )
}
});
});
</script>