Resize without Move

Page: 1

Author Post
Member
Registered: Feb 2013
Posts: 11
Hi,

I am using fb.resize(-1) to resize the height of a floatbox (non-modal) when the user moves their mouse over a div in the floatbox. If the user moves the floatbox prior to moving the mouse over the div inside the floatbox, then the floatbox returns to its original location after before resizing.

I have tried using fb.resize(-1, 0), fb.resize(-1, 0, null, null, false), fb.resize(-1, 0, -1, -1, false), and fb.resize(-1). The second and third ones move the floatbox to the upper-left corner of the screen. The others just return it to its original position.

How can I programmatically resize the floatbox without moving it?

Caleb
Administrator
Registered: Aug 2008
Posts: 3382
The API Reference entry for fb.resize gives some incorrect information. It states that passing null for left and top -- fb.resize( 0, 0, null, null ) -- will stick the box to its current location while remeasuring and setting width and height. This is false, and in fact passing nulls introduces buggy positioning behaviour.

For consisitency with the handling of the width and height paramaters, left and top should accept -1 to freeze them. I'll try to have this change in the next release. Note that this will stick the top-left corner of the box in place and any width and height changes will move only the right and bottom edges of the box.

For now, it's really easy to freeze the box with one additional line of code.Try something like:
	var layout = fb.getLayout(fb.fbBox);
fb.resize(-1, 0, layout.left, layout.top);

Page: 1