draggable

How to make HTML5 draggable objects over canvas?

梦想与她 提交于 2019-12-09 07:10:19
问题 I just started learning html5 and I am trying to create a battleship interface with draggable ships. I need help making my dragging methods work. I am purposely not using a library because I need make the ships draggable over another canvas interface (the battleship board), which I could not figure out how to do with the Kinetic library. I feel like I am close, but I cannot figure out the last bit. The ships should be smoothly dragged but they seem to snap to the location of the mouse when

jQuery Mobile - Enable scrolling disable page dragging

自闭症网瘾萝莉.ら 提交于 2019-12-09 06:35:27
问题 I am currently developing an iOS app using phonegap 1.5 and jQuery Mobile. I understand that we can disable page dragging using the following javascript: function preventBehavior(e) { e.preventDefault(); }; document.addEventListener("touchmove", preventBehavior, false); However, content scrolling would not work if the above is enabled. Is there any way I prevent users from dragging the page yet allow scrolling? I have tried using iScroll. For that I would need to manually do a scrollbar

jQuery: Creating a circular slider

陌路散爱 提交于 2019-12-09 06:22:13
问题 You may have seen JavaScript sliders before: http://dev.jquery.com/view/tags/ui/1.5b2/demos/ui.slider.html What I'm envisioning is a circular slider. It would consist of a draggable button at one point on the circle -- and that button can be dragged anywhere along the ring. The value depends on what position the button is at (think of a clock). 回答1: define a center point c current mouse point at m in your mouse drag event handler, you'd have var dx = m.x-c.x; var dy = m.y-c.y; var scale =

Can't get JQuery Draggable plugin to work?

人盡茶涼 提交于 2019-12-09 01:33:19
问题 I'm very new to JQuery and I'm trying to create a sample page using the Draggable plugin. The page loads fine, but I'm not able to drag my <div> tag anywhere. I've been trying to copy this demo. Here is my code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title></title> <style type="text/css"> #draggable { width: 150px; height: 150px; padding: 0.5em

Window dragging issue in IE

∥☆過路亽.° 提交于 2019-12-08 16:00:28
问题 ExtJS 4 I want my Ext.Window to be dragged outside the browser boundary. So I removed the scroll bars of the browser as document.documentElement.style.overflow = 'hidden'; // firefox, chrome document.body.scroll = "no"; // ie only In firefox its working fine. But in IE, whenever I drag the window outside, it is again snapped within the browser window. I want this (case 1) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | | | | | | | | | --window---- | | A | B | | -----+------ | | | | ~~~~~~~~~~~~~~~~~

Optimizing jQuery UI drag and drop schedule grid

半城伤御伤魂 提交于 2019-12-08 12:15:57
问题 I have a schedule grid based on a HTML table using jQuery/jQuery UI drag and drop. Each cell in the table represents a user and timeslot. I've got good performance in IE9, FireFox, and Chrome however IE8 is unusable because there is a several second pause between the time a user starts a drag and the time the drag helper appears. I know part of the problem is that I am creating a large number of droppables, in this case: 112 Users on a 24 hour grid (total of 2688 droppables created) If I

JQuery draggable - allow containment to multiple containers?

ε祈祈猫儿з 提交于 2019-12-08 11:20:54
问题 I'd like to allow users to drag an element from one container to another while still being constrained from being able to drag the element outside of either of those two containers. I have everything working perfectly except the part where they can drag to another container. View code and result on JSFiddle.net I thought this post seemed like the answer but it doesn't appear to work for me. 回答1: I added a jQuery UI droppable to your fiddle. With a little bit of tweaking I'm sure you'd be able

When Drag a object from one div to another , format gets changed

只谈情不闲聊 提交于 2019-12-08 10:40:21
问题 When a object is dragged and dropped from one div to another, the format in li gets changes to text only. I want it in the same format and style i.e 'li' after droping it. $(function() { $( "#catalog ul" ).sortable({ zIndex: 10000, revert: true }); $( "#catalog" ).accordion(); $( "#catalog ul" ).draggable({ appendTo: "body", helper: "clone", zIndex: 10000 }); $( "#dialogIteration ol" ).droppable({ activeClass: "ui-state-default", hoverClass: "ui-state-hover", drop: function( event, ui ) { $(

Firefox: Unable to Drag element child of <a> hyperlink

喜欢而已 提交于 2019-12-08 10:25:04
问题 Consider the following markup: <a class="link" href="#"> <sup draggable="true">Foo</sup> Bar </a> Now attach a dragstart event to the sup element: $(document).ready(function () { $("sup").on('dragstart', function(e) { console.log('shikaka'); }); }); This event will never fire. I've been researching and in Firefox, links are draggable by default, so I thought that this might work: $(document).ready(function () { $(".link").on('dragstart', function(e) { e.preventDefault(); e.stopPropagation; /

Android - how to simply drag and drop a button?

戏子无情 提交于 2019-12-08 09:33:38
问题 I found a beginner-friendly tutorial here: http://androidrox.wordpress.com/2011/05/13/android-sample-app-drag-and-drop-image-using-touch/ here is the xml code in my case: <AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/absLayout" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" > <Button android:id="@+id/myButton" android:layout_width="wrap_content"