Giter VIP home page Giter VIP logo

Comments (7)

bevacqua avatar bevacqua commented on August 15, 2024 12

CodePen would be nice. But basically: when dragging, your stuff is removed from its container, and appended to document.body. So any styles your element inherited from its parent, or any styles affected by siblings of your element, are gone now. Take that into account when adjusting the styles for your drag shadow.

from dragula.

bevacqua avatar bevacqua commented on August 15, 2024 3

dragula/example/example.css

Lines 116 to 130 in 4d2c87b

/*
* note that styling gu-mirror directly is a bad practice because it's too generic.
* you're better off giving the draggable elements a unique class and styling that directly!
*/
.container div,
.gu-mirror {
margin: 10px;
padding: 10px;
background-color: rgba(0, 0, 0, 0.2);
transition: all 0.4s ease-in-out;
cursor: move;
cursor: grab;
cursor: -moz-grab;
cursor: -webkit-grab;
}

from dragula.

johman10 avatar johman10 commented on August 15, 2024

Made a codepen but it doesn't seem to do the same.
In the codepen it hides the internal objects or something like that.
See for yourself over here:
http://codepen.io/johman10/pen/XbdNoo

Hope it shows the problem.
I'm think it has something to do with scss nesting... could that be it?

from dragula.

bevacqua avatar bevacqua commented on August 15, 2024

All your styles inherit from .options_menu. The options_menu class is nowhere in the dragged element.

from dragula.

johman10 avatar johman10 commented on August 15, 2024

Wow! That was pretty stupid! Should have seen that myself!

Thanks for you help and thanks for Dragula! Gotta love it!

from dragula.

bevacqua avatar bevacqua commented on August 15, 2024

Also fixed the example in the demo page for reference

from dragula.

aderchox avatar aderchox commented on August 15, 2024

Hi, a somewhat related question.
How do I change the cursor from grab to grabbing while dragging?
I've tried adding cursor: grabbing to both .gu-mirror and .gu-unselectable (which are the ones that seem to be related), but neither one is working.
This is in Svelte:

  .drgwrapper :is(:global(.gu-unselectable), :global(.gu-mirror)) {
    cursor: grabbing;
  }

I've also changed them inside /node_modules/dragula/dist/dragula.css (and restarted bundler), still without success.
I'm using Chrome.

from dragula.

Related Issues (20)

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.