drag-and-drop

check if div contains an element in jQuery

◇◆丶佛笑我妖孽 提交于 2020-01-13 09:09:59
问题 I'm bulding some drag and drop widgets in jQuery, once they've been dropped I need to check if my drag and droppable widget are inside another div. <div id="droptarget"> <div class="widget">I'm a widget!</div> </div> I've had a look at $('#droptarget').each but can't seem to figure it out. Any ideas? 回答1: If you want to select the outer div: $("#droptarget:has(div.widget)") If you want to select the widget: $("#droptarget > div.widget") 回答2: I would start with if ($ ('#droptarget .widget')) {

check if div contains an element in jQuery

随声附和 提交于 2020-01-13 09:09:10
问题 I'm bulding some drag and drop widgets in jQuery, once they've been dropped I need to check if my drag and droppable widget are inside another div. <div id="droptarget"> <div class="widget">I'm a widget!</div> </div> I've had a look at $('#droptarget').each but can't seem to figure it out. Any ideas? 回答1: If you want to select the outer div: $("#droptarget:has(div.widget)") If you want to select the widget: $("#droptarget > div.widget") 回答2: I would start with if ($ ('#droptarget .widget')) {

Unable to drag a button element in Firefox

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-13 08:29:09
问题 I'm having an issue with a project I'm working on. It's a web application with an interface that partly exists out of drag 'n drop elements. The issue is that the draggable div elements work fine but the button elements won't engage the drag in Firefox but they do work in Chrome. I think this might have something to do with the way Firefox handles the already existing events of the button, which is probably different than how Chrome does this. I know I can use jQuery UI instead but this

Html5 drag and drop on svg element

陌路散爱 提交于 2020-01-13 05:50:01
问题 I am trying to follow the html5 drag and drop tutorial here. I could not get the dragstart event to be registered on rect element. If I change the event from draggable to mousedown it calls the handleDragStart handler. Please ignore the additional blank registration in the code. JSFiddle here <!DOCTYPE html> <html><head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <style type="text/css" media="screen"> svg rect { cursor: move; } <

How to test drag and drop with Selenium on the react-dnd-treeview library

筅森魡賤 提交于 2020-01-13 05:33:06
问题 I'm trying to test a simple drag and drop behavior on a React app. I am using the react-dnd-treeview library and their example website to test my test case. When I run the tests in debug, I don't get any errors and Selenium is able to get the right elements, but nothing is happening, I'm not able to create or visualize any sort of actions, even after trying so many of the different answers in this similar question, but in vain. Here is the code I am working with: package tests; import org

Why can't I drag a Point between two instances of a program?

天涯浪子 提交于 2020-01-13 02:29:12
问题 I have a DoDragDrop where I set the data to a Point .when I drag within one instance – everything's OK. But when I drag between two instances of the program Visual Studio gives me this error: The specified record cannot be mapped to a managed value class. Why? EDIT: here's the code: DataObject d = new DataObject(); d.SetData("ThePoint", MyPoint); DragDropEffects e = DoDragDrop(d, DragDropEffects.Move); And: Point e2 = (Point)e.Data.GetData("ThePoint"); 回答1: The specified record cannot be

drag files or folders in textbox? C#

寵の児 提交于 2020-01-12 18:40:39
问题 How do i drag files or folders into a textbox? i want to put the foldername in that very textbox. C# .NET 回答1: i wrote this code based in this link public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { textBox1.AllowDrop = true; textBox1.DragEnter += new DragEventHandler(textBox1_DragEnter); textBox1.DragDrop += new DragEventHandler(textBox1_DragDrop); } private void textBox1_DragEnter(object sender, DragEventArgs e

drag files or folders in textbox? C#

不想你离开。 提交于 2020-01-12 18:40:09
问题 How do i drag files or folders into a textbox? i want to put the foldername in that very textbox. C# .NET 回答1: i wrote this code based in this link public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { textBox1.AllowDrop = true; textBox1.DragEnter += new DragEventHandler(textBox1_DragEnter); textBox1.DragDrop += new DragEventHandler(textBox1_DragDrop); } private void textBox1_DragEnter(object sender, DragEventArgs e

C# Drag & Drop Multiple Images within Canvas

断了今生、忘了曾经 提交于 2020-01-12 09:40:39
问题 I've got the following code to drag and drop images inside my Canvas: img.AllowDrop = true; img.PreviewMouseLeftButtonDown += this.MouseLeftButtonDown; img.PreviewMouseMove += this.MouseMove; img.PreviewMouseLeftButtonUp += this.PreviewMouseLeftButtonUp; private object movingObject; private double firstXPos, firstYPos; private void MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { // In this event, we get the current mouse position on the control to use it in the MouseMove event.

C# Drag & Drop Multiple Images within Canvas

懵懂的女人 提交于 2020-01-12 09:37:59
问题 I've got the following code to drag and drop images inside my Canvas: img.AllowDrop = true; img.PreviewMouseLeftButtonDown += this.MouseLeftButtonDown; img.PreviewMouseMove += this.MouseMove; img.PreviewMouseLeftButtonUp += this.PreviewMouseLeftButtonUp; private object movingObject; private double firstXPos, firstYPos; private void MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { // In this event, we get the current mouse position on the control to use it in the MouseMove event.