
- script.aculo.us 教程
- script.aculo.us - 主頁
- script.aculo.us - 概述
- script.aculo.us - 模組
- script.aculo.us - 可視效果
- script.aculo.us - 拖放
- script.aculo.us - 排序元素
- script.aculo.us - 建立捲軸
- script.aculo.us - 自動完成
- script.aculo.us - 就地編輯
- script.aculo.us 資源
- script.aculo.us - 快速指南
- script.aculo.us - 資源
- script.aculo.us - 討論
拖放使用 reverteffect 選項
說明
此選項用於定義當可拖動元素返回其起始位置時要使用效果。
預設為平滑滑動元素的原始位置。reverteffect 選項指定當 revert 選項設為 true 時,在 endeffect 函式之前呼叫的函式。
語法
new Draggable('element', {reverteffect: 'effectFunction'});
其中 effectFunction 是定義要應用的效果的函式。
示例
<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() { var img = 'myimage'; new Draggable('myimage' , { revert: true, reverteffect: function(){ new Effect.MoveBy('myimage', 100,100); } }); } </script> </head> <body> <p>Drag and leave this image to see the result.</p> <img id = "myimage" src = "/images/scriptaculous.gif"/> </body> </html>
執行上述操作會得到以下結果 -
scriptaculous_drag_drop.htm
廣告