jQueryUI Sortable, Resizable, cacheable

Today I had a very weird problem with jQuery UI, namely sortable doesn’t play nice when the sortable elements are also resizable. This means that if an element was resized, the placeholder had wrong size, despite the forcePlaceholderSize was either true or false. However, fortunate enough, sortable has plenty of events available and one of this is onStart (start actually):

$('.sortableWrapper > *').resizable();

  'forcePlaceholderSize': true,
  'start'               : function(e, ui){
    $(ui.placeholder).width( $(ui.item).width() ); // this is where magic happens

Leave a comment!

You can insert code snippets using BBcode:
[js].[/js] [html].[/html] [php].[/php] [css].[/css]
You can also use some HTML tags:
<blockquote>.</blockquote> <code>.</code> <a href="">.</a> <strong>.</strong> <em>.</em>

windows apple dropbox facebook twitter