johndoe johndoe - 6 months ago 21
Javascript Question

make draggable transparent >

i would like to know how to make a draggable transparent by default its white this is my website
http://amp.site88.net/

this is my code

<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Draggable - Default functionality</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<style>
#draggable { width: 150px; height: 150px; padding: 0.5em; }
</style><style>
body {
background-color: lightblue;
}
</style>
<script>
$("#draggable").css("background-color", "transparent");
</script>
<script>
$(function() {
$( "#draggable" ).draggable();
});
</script>
</head>
<body>

<div id="draggable" class="ui-widget-content">
<p>Drag me around</p>
</div>


</body>
</html>

Answer

Just edit your style block:

    #draggable { width: 150px; height: 150px; padding: 0.5em; background: transparent; }

and it should work :)

PS. you might have to add border: none; if you also want the border to disappear, leaving just the text.

Comments