File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,13 @@ $('.sortable').sortable({
4242 handle: ' h2'
4343});
4444```
45+ Setting ` forcePlaceholderSize ` option to true, forces the placeholder to have a height:
46+
47+ ``` javascript
48+ $ (' .sortable' ).sortable ({
49+ forcePlaceholderSize: true
50+ });
51+ ```
4552
4653Use ` connectWith ` option to create connected lists:
4754
Original file line number Diff line number Diff line change @@ -41,8 +41,7 @@ $.fn.sortable = function(options) {
4141 var dt = e . originalEvent . dataTransfer ;
4242 dt . effectAllowed = 'move' ;
4343 dt . setData ( 'Text' , 'dummy' ) ;
44- dragging = $ ( this ) . addClass ( 'sortable-dragging' ) ;
45- index = dragging . index ( ) ;
44+ index = ( dragging = $ ( this ) ) . addClass ( 'sortable-dragging' ) . index ( ) ;
4645 } ) . on ( 'dragend.h5s' , function ( ) {
4746 dragging . removeClass ( 'sortable-dragging' ) . fadeIn ( ) ;
4847 placeholders . detach ( ) ;
@@ -65,6 +64,9 @@ $.fn.sortable = function(options) {
6564 e . preventDefault ( ) ;
6665 e . originalEvent . dataTransfer . dropEffect = 'move' ;
6766 if ( items . is ( this ) ) {
67+ if ( options . forcePlaceholderSize ) {
68+ placeholder . height ( dragging . height ( ) ) ;
69+ }
6870 dragging . hide ( ) ;
6971 $ ( this ) [ placeholder . index ( ) < $ ( this ) . index ( ) ? 'after' : 'before' ] ( placeholder ) ;
7072 placeholders . not ( placeholder ) . detach ( ) ;
You can’t perform that action at this time.
0 commit comments