Dojo Moveable:限制移动到水平

时间:2014-05-12 08:45:42

标签: javascript html dojo moveabletype

我正在读这个:http://dojotoolkit.org/reference-guide/1.9/dojo/dnd/Moveable.html但似乎本指南里面有错误。自定义移动器部件无效!

我正在尝试开发标签。标签部分正在运行。现在我想让它们可移动。但我想限制可移动部分,如Firefox,Internet Explorer,Chrome等中的Tabs,你只能左右移动它们。我不知道如何实现它。任何人都可以给我建议吗?

目前我制作了一个包含2个DIV标签的测试HTML。如果将一个标签移动到第二个标签上,则应将鼠标(带有所选标签)的标签放在标签之后。它应该用道场制作。

<html>
    <head>
        <title>My Drag & Drop</title>
        <link rel="stylesheet" href="http://dojotoolkit.org/reference-guide/1.9/_static/default.css" type="text/css" />
        <link rel="stylesheet" href="http://dojotoolkit.org/reference-guide/1.9/_static/pygments.css" type="text/css" />
        <link rel="stylesheet" href="http://dojotoolkit.org/reference-guide/1.9/_static/css/site.css" type="text/css" />

        <link rel="stylesheet" href="http://dojotoolkit.org/reference-guide/1.9/_static/js/docs/resources/guide.css" type="text/css" />
        <link rel="stylesheet" href="dojo/dijit/themes/dijit.css" type="text/css" />
        <link rel="stylesheet" href="dojo/dijit/themes/claro/claro.css" type="text/css" />
        <script src="dojo/dojo/dojo.js"
            data-dojo-config="async: true"></script>
    </head>
    <body>
    <script type="text/javascript" >
        require(["dojo/_base/declare", "dojo/dnd/Mover", "dojo/dom", "dojo/dnd/Moveable","dojo/domReady!"],
function(declare, Mover, dom, Moveable){


  //Create your "Moveable" as
  var myMoveable = new Moveable(dom.byId("id1"));
});

    </script>
        <div id="id1" style="width:250; height:250; background-color:black; margin-right:10px; position: absolute; top: 10px; left:10px; margin-top:50px; margin-left:10px;margin-bottom: 10px;">test
        </div>

        <div id="id2" style="width:250; height:250; background-color:black; position: absolute; left: 200; margin-right:10px;margin-top:50px; margin-left:250px;margin-bottom: 10px;"> test
        </div>
    </body>
</html>

感谢您的帮助

1 个答案:

答案 0 :(得分:0)