jQuery UI Sortable Portlets Force right or left

106 views Asked by At

Based off this example on jsfiddle, what I have is identical. I'm trying to come up with a way for when you have an empty space on the right and be able to move the left div to the right without being forced back.

I've tried the following css:

$(function() 
    if( $(".portlet").css('left', '165px') ) { 
        $(".portlet").css('left', '51%');
    } else {
      $(".portlet").css('left', '1%');
    }
)};

Just to note that I'm fairly new to jQuery UI.

1

There are 1 answers

0
Julien Grégoire On

One simple way to do this, if it doesn't interfere with the rest of your layout, would be to force the height of your sortable. Like this:

.sortable {
  width: 200px;
  float: left;
  padding-bottom: 100px;
  height: 600px;
}

http://jsfiddle.net/g6urafLf/1/