Ask questions and get good answers on jQuery

1
1

I've been having a lot of fun with this module trying to make a proof of concept mdi web page.

I was wanting to have the containerPlus containers appear inside a div section of my page only. I setup the containment option to the div and when dragging it works perfectly. When resizing a container the container can be made larger than the containment area. It seems the declaration for the resizable class in the containerPlus code doesn't actually set the containment option for resizable but the draggable declaration is setting it.

Am I missing something or is this working the was it is intended to be working?

asked Jan 21 '10 at 20:26

John%20Saterfiel's gravatar image

John Saterfiel
211

edited Jan 24 '10 at 21:31

Matteo%20Bicocchi's gravatar image

Matteo Bicocchi ♦♦
1776129


That seems a bug...

Add after line 96:

if (container.metadata().containment) container.attr("containment",container.metadata().containment);

Change at line 205 the "start" callback with:

  start:function(e,o){
    var el= container.attr("containment")?container.parents():$(window);
    var elPos= container.attr("containment")? container.position():container.offset();
    $(container).resizable('option', 'maxHeight',el.height()-(elPos.top-5));
    $(container).resizable('option', 'maxWidth',el.width()-(elPos.left-5));
    o.helper.mb_bringToFront();
  }

add as metadata of your container:

{containment:"parent", ...

answered Jan 24 '10 at 21:23

Matteo%20Bicocchi's gravatar image

Matteo Bicocchi ♦♦
1776129

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

×6
×1

Asked: Jan 21 '10 at 20:26

Seen: 365 times

Last updated: Aug 09 '10 at 05:23

jQuery main site - Matteo Bicocchi