Resize a Div Layer with JavaScript
Formula and example included.
Pseudo formula:
// Acronyms used to save space. New style.left = PCW+((E.X-PCX)-(MDX-PCX)) New style.top = PCH+((E.Y-PCY)-(MDY-PCY)) // PCW/PCH = Previous Container Width/Height. // E.X/E.Y = Event X/Y. // PCX/PCY = Previous Container Left/Top. // MDX/MDY = Mouse Down X/Y (where you clicked).
With this formula you will resize the layer relative to where you clicked on it. An extended version of the movement formula. In effect it will take the existing width/height and add the amount of pixel movement as a positive or negative number.
CTRL + click on and hold and drag to resize the layer.