jQuery UI Draggable / Droppable with Slick carousel

1.5k views Asked by At

I am trying to implement jQuery UI Draggable / Droppable in Slick carousel single items. But I am not able to make it work on combination with each other.

I got reference from Reference link but not working with my case.

My Fiddle

var slick = $('.stack').slick({
    centerMode: true,
    centerPadding: '80px',
    arrows: false,
    variableWidth: true,
    dots: true,
    swipeToSlide: true,
    focusOnSelect: true
});

    $( "#draggable" ).draggable();
    $( "#droppable" ).droppable({
      drop: function( event, ui ) {
        $( this )
          .addClass( "ui-state-highlight" )
          .find( "p" )
            .html( "Dropped!" );
      }
    });

$("#droppable").on("slide mouseenter mousedown",function(event){
    event.stopPropagation();
});
1

There are 1 answers

0
JinWoo Hyeon On

Add this line : $( '*[draggable!=true]', '.slick-track' ).unbind( 'dragstart' );

var slick = $( '.stack' ).slick( {
    centerMode: true,
    centerPadding: '80px',
    arrows: false,
    variableWidth: true,
    dots: true,
    swipeToSlide: true,
    focusOnSelect: true
} );

$( '#draggable' ).draggable();
$( '#droppable' ).droppable( {
    drop: function( event, ui ) {
        $( this ).addClass( 'ui-state-highlight' ).find( 'p' ).html( 'Dropped!' );
    }
} );

$( '*[draggable!=true]', '.slick-track' ).unbind( 'dragstart' );
$( '#droppable' ).on('slide mouseenter mousedown', function( event ) {
    event.stopPropagation();
} );