SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Jquery portlets

  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2006
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Jquery portlets

    Hi,

    I don't know how to set a cookie for below jquery script to remember the layout the user made when they visit page next time.
    Sorting is now working like this (http://ui.jquery.com/demos/sortable#portlets) but I don't know how to set cookie to remember the layout.
    I hope someone can help me. Thanks in advance.

    PHP Code:
    $(document).ready(function(){
        $(
    ".sortwrapper").sortable({
            
    accept'portlet-blocko',
            
    connectWith: ['.sortwrapper'],
            
    items'.portlet-blocko',
            
    reverttrue,
            
    dropOnEmptytrue,
            
    tolerance'pointer',
            
    handle'h2',
            
    cursor'move',
            
    forcePlaceholderSizetrue,
            
    placeholder'placeholder',
            
    opacity'0.9'
        
    });    
    });

    <
    div id='frontpagerightcol' class='sortwrapper'>
        
        <!-- 
    Block A -->
        <
    div class='portlet-blocko'><div class='portlet-blocki'>
            <
    h2>Block A</h2>
            <
    div class='content'>Some Description</div>    
        </
    div></div>
        
        <!-- 
    Block B -->
        <
    div class='portlet-blocko'><div class='portlet-blocki'>
            <
    h2>Block B</h2>
            <
    div class='content'>Some Description</div>    
        </
    div></div>

    </
    div>

    <
    div id='frontpagerleftcol' class='sortwrapper'>

        <!-- 
    Block C -->
        <
    div class='portlet-blocko'><div class='portlet-blocki'>
            <
    h2>Block C</h2>
            <
    div class='content'>Some Description</div>    
        </
    div></div>
        
        <!-- 
    Block D -->
        <
    div class='portlet-blocko'><div class='portlet-blocki'>
            <
    h2>Block D</h2>
            <
    div class='content'>Some Description</div>    
        </
    div></div>

    </
    div

  2. #2
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why dont you try giving each sortable item in id and then use the toArray method of the sortable object to places the id's into an array.

    From there you can simply place the array values into the cookie. Good luck!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •