標籤:jquery ui 拖動(draggable) - 還原位置
定義和用法
當帶有布爾值 revert 選項的 draggable 停止拖拽時,返回 draggable(或它的助手)到原始位置
樣本
<!DOCTYPE html><html><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><title>jQuery UI 拖動(Draggable) - 還原位置</title><link rel="stylesheet" href="js/jquery-ui-1.12.1.custom/jquery-ui-1.12.1.custom/jquery-ui.min.css"><style>#draggable1, #draggable2 { width: 200px; height: 200px; padding: 0.5em; float: left; margin: 0 10px 10px 0; } #draggable p { cursor: move; }</style></head><body><div id="draggable1" class="ui-widget-content"> <p>還原</p></div> <div id="draggable2" class="ui-widget-content"><p>還原助手</p></div><script src="js/jquery-ui-1.12.1.custom/jquery-ui-1.12.1.custom/external/jquery/jquery.js" type="text/javascript" ></script><script src="js/jquery-ui-1.12.1.custom/jquery-ui-1.12.1.custom/jquery-ui.min.js"></script><script>$(function(){$("#draggable1").draggable({revert:true});$("#draggable2").draggable({revert:true,helper:‘clone‘});});</script></body></html>
輸出
650) this.width=650;" src="https://s3.51cto.com/wyfs02/M00/8D/A8/wKioL1ilXPiyGD3DAAALC6MJGDM208.png-wh_500x0-wm_3-wmp_4-s_3325224465.png" title="QQ20170216160332.png" alt="wKioL1ilXPiyGD3DAAALC6MJGDM208.png-wh_50" />
本文出自 “素顏” 部落格,請務必保留此出處http://suyanzhu.blog.51cto.com/8050189/1898509
jQuery UI 拖動(Draggable) - 還原位置