johndoe johndoe - 1 year ago 115
Javascript Question

How to make draggable transparent?

i would like to know how to make a draggable transparent. Currently the background is white. Here's my website:

this is my code:

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

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


Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download