Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Shrinkwrap body element after dragging blocks



2:30 pm on Mar 22, 2013 (gmt 0)

5+ Year Member

Hello - I am using jQuery to drag div elements. Think of my layout as one large box, with 2 small boxes next to each other below the big box. Those 2 smaller boxes are draggable. Users will drag those 2 smaller boxes onto the big box.

The result will be printed out - and I have the big box roughly the size of a printed page. The smaller boxes cause there to be 2 printed pages. I want the body to shrink as they drag, or onmouseout - so if they entirely drag the small boxes on top of the big one, they aren't having to print a blank sheet of paper (which once held the smaller boxes).

Anyone know how to dynamically shorten the body/html element that is keeping the page length once the small boxes are moved up?



4:33 pm on Mar 22, 2013 (gmt 0)

5+ Year Member

Okay - I have figured out that the html box (documentElement) is the issue. So new question:

Is it possible to reduce the document.documentElement.scrollheight with javascript? I can figure out the height needed, but

document.documentElement.scrollheight = "700px";
document.documentElement.offsetheight = "700px";

doesn't work


4:52 pm on Mar 22, 2013 (gmt 0)

5+ Year Member

Oops - nevermind. Figured it out. Needed to adjust the style:
document.documentElement.style.height = "700px";

Featured Threads

Hot Threads This Week

Hot Threads This Month