Javascript 不拖拉
我正在chrome中尝试dragula,我无法让它工作,需要额外的代码来让它工作吗 这是密码Javascript 不拖拉,javascript,drag-and-drop,dragula,Javascript,Drag And Drop,Dragula,我正在chrome中尝试dragula,我无法让它工作,需要额外的代码来让它工作吗 这是密码 <!DOCTYPE html> <html> <head> <title>TODO supply a title</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-sc
<!DOCTYPE html>
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="dragula.css" rel="stylesheet" type="text/css"/>
<style>
.wrapper div div{
background: #FCE8FB;
margin: 12px 6px 12px 2px;
}
</style>
<script src="dragula.min.js" type="text/javascript"></script>
<script>
dragula([document.getElementById('left1'), document.getElementById('right1')]);
</script>
</head>
<body>
<div class='wrapper' style=" border: black 3px solid;">
<div id='left1' class='container' style=" border: black 1px solid;">
<div>You can move these elements between these two containers</div>
<div>Moving them anywhere else isn't quite possible</div>
<div>There's also the possibility of moving elements around in the same container, changing their position</div>
</div>
<div id='right1' class='container' style=" border: black 1px solid;">
<div>This is the default use case. You only need to specify the containers you want to use</div>
<div>More interactive use cases lie ahead</div>
<div>Make sure to check out the <a href='https://github.com/bevacqua/dragula#readme'>documentation on GitHub!</a></div>
</div>
</div>
</body>
</html>
提供头衔
.wrapper div{
背景#FCE8FB;
保证金:12px 6px 12px 2px;
}
dragula([document.getElementById('left1')、document.getElementById('righ1'));
可以在这两个容器之间移动这些元素
把它们移到别的地方不太可能
也有可能在同一容器中移动元素,改变它们的位置
这是默认的用例。您只需要指定要使用的容器
更多的交互式用例摆在面前
一定要查看
我遗漏了什么吗?看起来您的脚本运行得太快了,还没有呈现出它要针对的元素 将头部中的脚本标记更改为:
window.onload = function() {
dragula([document.getElementById('left1'), document.getElementById('right1')]);
}
可能的重复。这是一个特定的Dragula Js问题,而不是重复,thanksHah,永远不要忘记思考您的JavaScript是否试图对不存在的东西进行处理。