[英]jQuery draggable and scroll not working : mobile devices
i am trying to figure out how to make draggable and scollable work simulatnoeusuly: 我想弄清楚如何制作可拖动和可分解的工作simulatnoeusuly:
http://159.8.132.20/alldevice/
when u try to drag image on either side draggable action also starts, i want that area to be easily scrollable, means when i am scrolling draggble event should not be there 当你试图在任何一侧拖动图像时,draggable动作也会启动,我希望该区域可以轻松滚动,意味着当我滚动draggble事件不应该在那里
var $drop = $('#canvas-drop-area,#canvas-drop-area1'),
$gallery = $('#image-list li'),
$draggedImage = null,
$canvasp1old = null,
$canvasp2old = null;
$gallery.draggable({
//refreshPositions: true,
scroll: false,
start: function(e) {
$draggedImage = event.target;
$drop.css({
'display': 'block'
});
},
helper: function(e) {
return $('<img src="' + $(this).find('img').attr("src") + '" width="'+imgwidth+'">');
},
stop: function() {
$draggedImage = null;
},
revert: true
});
This might help you. 这可能对你有帮助。
$("#draggable").draggable({ snap: true }); $("#draggable2").draggable({ snap: ".ui-widget-header" }); $("#draggable3").draggable({ snap: ".ui-widget-header", snapMode: "outer" }); $("#draggable4").draggable({ grid: [20, 20] }); $("#draggable5").draggable({ grid: [80, 80] });
.draggable { width: 90px; height: 80px; padding: 5px; float: left; margin: 0 10px 10px 0; font-size: .9em; } .ui-widget-header p, .ui-widget-content p { margin: 0; } #snaptarget { height: 600px; width: 200px; }
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script src="http://code.jquery.com/ui/1.11.2/jquery-ui.js"></script> <table> <tr> <td> <div id="draggable" class="draggable ui-widget-content"> <p>Default (snap: true), snaps to all other draggable elements</p> </div> <div id="draggable2" class="draggable ui-widget-content"> <p>I only snap to the big box</p> </div> </td> <td> <div id="snaptarget" class="ui-widget-header"> <p>I'm a snap target</p> </div> </td> <td> <div id="draggable3" class="draggable ui-widget-content"> <p>I only snap to the outer edges of the big box</p> </div> <div id="draggable4" class="draggable ui-widget-content"> <p>I snap to a 20 x 20 grid</p> </div> <div id="draggable5" class="draggable ui-widget-content"> <p>I snap to a 80 x 80 grid</p> </div> </td> </tr> </table>
$(function() {
$("#draggable").draggable({
snap: true
});
$("#draggable2").draggable({
snap: ".ui-widget-header"
});
$("#draggable3").draggable({
snap: ".ui-widget-header",
snapMode: "outer"
});
$("#draggable4").draggable({
grid: [20, 20]
});
$("#draggable5").draggable({
grid: [80, 80]
});
});
For Mobile you can use jquery ui touch punch it will help you and best solution is here 对于Mobile,你可以使用jquery ui touch punch它会帮助你,最好的解决方案就在这里
as per my knowledge jquery and jquery-ui is working awesome on 159.8.132.20/alldevice/. 根据我的知识,jquery和jquery-ui在159.8.132.20/alldevice/上工作得很棒。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.