jQuery UI draggable Options opacity

Helper opacity while dragging.
$("#eleID").draggable({  opacity: 0.5 });
ExampleJquery ui draggable options opacity
Source Code Expand
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<script type="text/javascript" src="http://www.pureexample.com/js/lib/jquery.ui.touch-punch.min.js"></script>


<!-- CSS -->
<style type="text/css">
.square {
    width: 200px;
    height: 200px;
    border: 1px solid black;
    margin-bottom: 5px;
    margin-left: 5px;
    text-align: center;
    line-height: 200px;
    background-color: lightblue;
    cursor: pointer;
}
</style>


<!-- Javascript -->
<script>
    $(function () {
        $("#dragItem").draggable({
            opacity: 0.5
        });
        $("#slider").slider({
            range: "min",
            value: 0.5,
            min: 0.1,
            max: 1,
            step: 0.01,
            slide: function (event, ui) {
                $("#info").html("dragging opacity : " + ui.value);
                $("#dragItem").draggable("option", "opacity", ui.value);
            }
        });
    });
</script>

<!-- HTML -->
<div>
    <div id="dragItem" class="square"><span id="info">dragging opacity : 0.5</span></div>          	    
</div>
Slide to adjust dragging opacity
<div id="slider" style="width:300px"></div>


comments powered by Disqus