拖放及还原选项


说明

如果设为 true,那么元素在拖动结束后会返回到其原始位置。它还指定是否在停止拖动操作时调用reverteffect 回调。默认为 false。

语法

以下为设置revert 选项的简单语法。

new Draggable('element', {revert:true});

示例

<html>
   <head>
      <title>Draggables Elements</title>
		
      <script type = "text/javascript" src = "/javascript/prototype.js"></script>
      <script type = "text/javascript"src = "/javascript/scriptaculous.js"></script>
		
      <script type = "text/javascript">
         window.onload = function() {
            new Draggable('myimage', {revert:true} );
         }
      </script>
   </head>

   <body>
      <p>Drag it and then leave it to see the result:</p>
      <img id = "myimage" src = "/images/scriptaculous.gif"/>
   </body>
</html>

将产生以下结果 −

scriptaculous_drag_drop.htm
广告