如何使可拖动透明?
How to make draggable transparent?
我想知道如何使可拖动对象透明。当前背景为白色。这是我的网站:
http://amp.site88.net/
这是我的代码:
<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>
只需编辑您的样式块:
#draggable { width: 150px; height: 150px; padding: 0.5em; background: transparent; }
它应该可以工作:)
PS。如果您还希望边框消失,只留下文本,则可能需要添加 border: none;
。
我想知道如何使可拖动对象透明。当前背景为白色。这是我的网站: http://amp.site88.net/
这是我的代码:
<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>
只需编辑您的样式块:
#draggable { width: 150px; height: 150px; padding: 0.5em; background: transparent; }
它应该可以工作:)
PS。如果您还希望边框消失,只留下文本,则可能需要添加 border: none;
。