Grow your CSS skills. Land your dream job.

I want to display jQuery sortable order from a cookie

  • # August 9, 2012 at 8:19 am

    Hi,

    I have a jQuery sortable area where a user can move widgets to different positions in a grid style layout.
    I have managed to save the sort order to a cookie once the user is finished moving stuff around.

    I now want to set the display order to reflect the order in the cookie.

    All ideas would be much appreciated.

    	//Create MYAREA sortable widgets
    $( "#myarea" ).sortable({
    start: function( event, ui ) {
    ui.placeholder.height(widgetHeight);
    },
    // SET Cookie to save sortable order
    update:function(event, ui) {
    var order = $( "#myarea" ).sortable("toArray").join();
    $.cookie("MYAREAORDER",order);
    },
    stop: function( event, ui ) {
    setWidgetDisplay('myarea');
    }
    });
    $( "#myarea" ).disableSelection();

    So I have a cookie called MYAREAORDER with its value “#id1,#id2,#id3#id4…”

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".