sunpietro / dragster Goto Github PK
View Code? Open in Web Editor NEWTiny vanilla JS plugin that enables drag'n'drop interactions to a user of your website
Home Page: http://sunpietro.github.io/dragster/
License: MIT License
Tiny vanilla JS plugin that enables drag'n'drop interactions to a user of your website
Home Page: http://sunpietro.github.io/dragster/
License: MIT License
There are parameter to set a child element from a dragster-block, for example fa fa-arrows icon
I started using this plugin and noticed that on IE9 it doesn't work, the drag item just doesn't drag. Is it normal? Doesn't this plugin give support for IE9 at all?
Thanks
Unexpected possibility to drop elements to unexpected regions when a draggable element is placed another draggable element.
Steps to reproduce the issue:
Actual result:
Element is dropped on disallowed region.
Expected result:
Element should not be dropped on disallowed region.
Hi, I m trying to use Dragster on typescript project, but I cant import your lib.
import * as Dragster from 'dragster.es6.js';
I get this on the console
Cannot find module 'dragster.es6.js'
If I set wrapDraggableElements: false
and add draggable="true" class="dragster-draggable"
to the elementSelector element isDraggableCallback()
returns false because element.dataset.dragsterId
is not set.
It appears to me as this has replaced the draggable="true"
attribute at some point as I can't see that, that is used.
Setting dragsterId
inside wrapDraggableElements()
as follows fixes this.
wrapDraggableElements = function (elements) {
if (finalParams.wrapDraggableElements === FALSE) {
elements.forEach(function (draggableElement) {
draggableElement.dataset.dragsterId = dragsterId;
})
...
Hi, on mobile when I drag one element to another place and then i try to scroll the page it doesn't scroll. From the tests I made it also happens on the demo page. Do you have any idea why this happens?
I would like to add drag'n'drop interface to new elements added to any region handled by Dragster.js library.
Hello,
first of all congrats by this awesome library !! ๐ ๐
works sweet.
Just found a problem using this OnBeforeDragEnd function.
I am setting the current region with draggable elements as occupied.
So if a new draggable elements try to be dropped there i check a condition and then:
Option 1) i replace the current element by the new one.
Option 2) i prevent the element to be blocked (something like not allowed position);
onBeforeDragEnd(e) {
if(!!e.dragster) {
let origin = e.dragster.drag.node;
let destination = e.dragster.drop.node;
if(!!origin && !!origin.parentNode) {
if(origin.parentNode.classList.contains('slot')) {
origin.parentNode.classList.remove('occupied');
}
}
if(!!destination) {
let slotIsOccupied = destination.classList.contains('occupied');
let slotIsNotAllowed = destination.classList.contains('not-allowed');
if(slotIsOccupied && !slotIsNotAllowed) {
// This removeChild is not working because you already added the element there
// the temp one, and that is awesome
// i just want to remove the element already there and then add this one
// destination.removeChild(destination.firstChild);
} else if (slotIsNotAllowed) {
// Here prevent the element to be dropped
} else {
// If the slot is available i add the 'occupied' for the new element dropped
destination.classList.add('occupied');
}
}
}
}
Because of my project needs i cannot have a region where you just add elements one above or below another.
I need to have like fixed slots. So i implemented this way :
<ul class='column'>
<li class='region--drag slot'></li>
<li class='region--drag slot'></li>
<li class='region--drag slot'></li>
<li class='region--drag slot'></li>
<li class='region--drag slot'></li>
<li class='region--drag slot'></li>
<li class='region--drag slot'></li>
<li class='region--drag slot'></li>
<li class='region--drag slot'></li>
<li class='region--drag slot'></li>
<li class='region--drag slot'></li>
<li class='region--drag slot'></li>
<li class='region--drag slot'></li>
<li class='region--drag slot'></li>
<li class='region--drag slot'></li>
</ul>
I hope that you understand my question and be able to oriented me ๐
Thanks in advance
As a user I would like to define a zone where all the draggable blocks will be defined, but a user won't be able to move them. The blocks will be cloned into the drop area.
Imagine the shopping cart and a list of products that can be dropped inside the cart multiple times.
There's missing callback when an element is dropped. It's needed to provide custom interactions after dropping elements.
Disable drag'n'drop when clicking with right mouse button.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.