gpt4 book ai didi

javascript - 德拉古拉不拖

转载 作者:行者123 更新时间:2023-12-02 15:51:23 24 4
gpt4 key购买 nike

我正在尝试拖古拉 https://github.com/bevacqua/dragula在 Chrome 中,我无法让它工作,需要任何额外的代码才能让它工作吗?

这是代码

<!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>

我错过了什么吗?

最佳答案

看起来您的脚本运行得太快,在渲染它想要定位的元素之前。

将头部的脚本标记更改为:

window.onload = function() {
dragula([document.getElementById('left1'), document.getElementById('right1')]);
}

关于javascript - 德拉古拉不拖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31831946/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com