homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

Shrinkwrap body element after dragging blocks

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

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)

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)

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

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved