Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Drag and drop from localstorage HTML5 not working

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #247844
    giriam07
    Participant

    I have created a web page with drag and drop features for some of the elements.

    Once the drag and drop are done, I store the elements which are in the droppable area in the local storage of the browser.

    Later when the page is accessed again, I take the values from local storage and restore them on the web page.

    After I restore, I couldn’t drag the elements in the droppable area within its containment. Could anyone please help?

    FIDDLE(https://jsfiddle.net/giriam07/bszf3ww9/)

    #247854
    Shikkediel
    Participant

    Solved perhaps? Seems to be working as expected from what I can see.

    #247855
    Shikkediel
    Participant

    Okay, I see what you mean now. It can be dragged but will go back to it’s original place instead of staying at the new position. Not solved then, I’ll have another look to figure out the cause.

    #247860
    Shikkediel
    Participant

    It must be somehow caused by the element not being dragged into the droppable area, making the revert parameter active because of this. Not sure how to solve this better than by just disabling it for the elements present inside it at the start:

    $('#droppable .ui-draggable').draggable( "option", "revert", false );
    

    https://jsfiddle.net/dL4p5018/

    Maybe another member has more experience with it.

    #247908
    giriam07
    Participant

    Really thanks a lot friend ‘Shikkediel’. You nailed it. It really worked for me as I need it.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.