jQuery UI 拖動(Draggable) - 延遲開始

來源:互聯網
上載者:User

標籤:jquery ui 拖動(draggable) - 延遲開始

定義和用法
通過 delay 選項設定延遲開始拖拽的毫秒數。通過 distance 選項設定游標被按下且拖拽指定像素後才允許拖拽


樣本
<!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: 120px;height: 120px;padding: 0.5em;float: left;margin: 0 10px 10px 0;}</style></head><body><div id="draggable1" class="ui-widget-content">  <p>只有把我拖拽了 100 像素後,拖拽才開始</p></div><div id="draggable2" class="ui-widget-content">  <p>不管 distance 是多少,您都必須拖拽並等待 1000ms 後拖拽才開始</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>//100表示像素$("#draggable1").draggable({distance:100});//1000表示1000豪秒,也就是1秒$("#draggable2").draggable({delay:1000});</script></body></html>


輸出

650) this.width=650;" src="https://s4.51cto.com/wyfs02/M01/8D/A9/wKiom1ilQNXSualuAAA380g6puE145.png-wh_500x0-wm_3-wmp_4-s_3991046957.png" title="QQ20170216140327.png" alt="wKiom1ilQNXSualuAAA380g6puE145.png-wh_50" />

本文出自 “素顏” 部落格,請務必保留此出處http://suyanzhu.blog.51cto.com/8050189/1898441

jQuery UI 拖動(Draggable) - 延遲開始

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.