1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Jquery UI : How to restrict draggable element to desired position

Discussion in 'jQuery' started by Prabhat0008, Jul 26, 2016.

  1. #1
    Hi All, I have a query that , I am using jquery sortable

    http://jqueryui.com/sortable/#default

    Open the above link , My requirement is that if any user drag the item 1 in y direction and when the item 3 slides up , drag should be stopped.

    Means dragging element should not drag below the item-3.

    Only possible drop area of item 1 is
    between item 2 and item 3
    between item3 and item 4

    Please help me to achieve this.
     
    Prabhat0008, Jul 26, 2016 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    Set a specific class as .droppable and add that dynamically to the elements when you're starting to drag. Then assign the droppable class as the only one allowed to receive draggable.
     
    PoPSiCLe, Jul 26, 2016 IP