Git Product home page Git Product logo

dragdropinterface's Introduction

##Building a Drag-n-Drop Interface Drag and drop is almost a goto way for various user interactions. More often than not, drag and drop functionality required is quite simple and easily solved by jQuery UI or other frameworks. Things start to get murky when you are working with an iframe (as always!) or need to mould the drag and drop to your needs.

Thankfully, HTML5 brought a native way to handle drag and drop events which should have made things simpler but that wasn’t the case. HTML5 Drag and Drop is still quite raw and full of gray areas. It doesn’t help that debugging drag and drop is quite painful most of the times.

Creating a Drag and Drop interface (like StackHive) required a lot of fiddling around with the HTML5 DnD API. After a lot searching around for articles and resources that would be more relevant for my use case, I came up short. So, after spending a lot of time on it I decided to roll it out as an open source plugin.

##Full Article at - http://blog.stackhive.com/post/137799349684/building-a-seamless-drag-and-drop-interface ##DEMO at - http://stackhive.com/blogdemos/dragdrop/demointerface.html

dragdropinterface's People

Contributors

kshitizshankar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dragdropinterface's Issues

Eliminate the ability to drag into a tag

How would I eliminate the ability to drag into a particular tag. This should be a default function, but it doesn't appear to be. See Screenshot:
screenshot02005

It should not be possible to drag a H1 tag (or any other elements) into a 'p' paragraph tag. The same thing is possible if there is a line break in the H1 tag.. you can drag other elements into it.

$('#clientframe').load() callback doesn't fire consistently

First issue!

I've just started playing around with this, but I'm noticing the functionality isn't being loaded consistently.

I was quickly going through the DOM for times when the functionality didn't load and noticed the <style data-reserved-styletag></style> tag wasn't being injected into the <iframe>, so I put a console.log into the $("#clientframe").load()

It seems the callback on that function doesn't get called consistently on every page-load.

This is just the straight repo I copied/pasted into my /www/ directory, with the exception of the console.log statement, I haven't modified anything.

Here's a video of it in action with the console.log's

https://drive.google.com/file/d/0B4ZYP-9VMhPda3JWUWdIQmx1RXM/view?usp=sharing

I'll play around with it more thoroughly but thought I'd post to see if you had any initial thoughts?

Make the iframe scrollable during DnD

I have noticed that the iframe is not scrollable during the element dragging.

I am working on a project where the user must be able to scroll down the iframe to drop anywhere.

The Droppable demo from jqueryui.com works :
https://jqueryui.com/droppable/

I guess its because the list of elements is located in the parent document as opposed to the jqueryui demo where the draggable element is located in the same document as the drop zone.

I d'like to solve this issue implementing this answer:

https://stackoverflow.com/questions/7279477/how-to-make-iframe-listen-to-scroll-events-as-parent-when-click-event-within-par

Could you please put me on the path?

Once again thank you for this interface!

Demo not working

I'm not able to run the demo properly. When I try to run the demo, in google chrome, I get a few errors. Here are pictures of the error I am getting
error1
error2

No Elements dropping in Safari, on Windows

Looks like there's an issue with no elements dropping into the page, in Safari, on Windows (10). ~found this on my demo, but the same thing happens on yours.

The Drop Marker appears, console.log shows there is action, but no elements appear on the page when dropped.

Without the iFrame

I like the concept of this, and have played around with it, however…

I would like to do something like this without the iframe, as I do not wish to work within an iFrame. But, I'm having a little trouble figuring out what needs to be altered in the dnd file to make this work.

**or, 'worst-case scenario' haha, target a div="content" in the frame (as apposed to the body).

Any chance an alternate/edited version of this can be provided.

License

Hello Kshitiz,

thanks a lot for providing a DnD solution that also works for iframes!
Under what license is your source code licensed?

Best,

Sandro

Dragable content in the frame

Hi,
Is that possible to make content that dragged into a frame to be draggable inside the iframe itself?
Currently in the demo only able to drag the block inside LI into a frame.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.