Coder Social home page Coder Social logo

dragsort's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

dragsort's Issues

Wrong width and height for placeholder

https://github.com/agavazov/dragsort/blob/master/dist/js/jquery.dragsort.js#L152

                        list.placeHolderItem = list.draggedItem.next().css({
                            height: h,
                            width: w
                        }).attr('data-placeholder', true);

Actual the placeholder dimensions are wrong(smaller), when items have paddings. Should be like:

                        list.placeHolderItem = list.draggedItem.next().css({
                            height: list.draggedItem.outerHeight(),
                            width: list.draggedItem.outerWidth()
                        }).attr('data-placeholder', true);

And you should maybe remove unnecessary "var"?

var h = list.draggedItem.height();
var w = list.draggedItem.width();

"calculate box the dragged item" is not working correctly

I have a input for tags.
<span><ul><li>Tag1</li><li>Tag2</li></ul></span>
LI have a margin-top and margin-right of 5px and "padding: 0 5px 5px 5px".
So LI have always a distance of 5px between LI and UL.

LI is height = 24px
UL is height = 34px (24 + 5 li-margin-top + 5 ul-padding-bottom)

Your calculate box value is correct. But LI have a margin-top of 5px, so your area its shifted down 5px.

https://github.com/agavazov/dragsort/blob/master/dist/js/jquery.dragsort.js#L166

list.draggedItem.css({position: 'absolute', opacity: 0.8, 'z-index': 999, height: h, width: w});

should be with margin=0?

list.draggedItem.css({position: 'absolute', opacity: 0.8, 'z-index': 999, height: h, width: w, margin: 0});

So its working in my test case correctly. dragitem should move freely in container, without margin.

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.