- Create Account

DragResize Script [Minimize Function Needed]

Forums > DragResize > DragResize Script [Minimize Function Needed]
Author
Message

1) akulion Group: Members
Posts: 1 Joined: 25 Sep 2006 Location: IP: 221.132.--.--
Hi,

This is a great script, Ive been working around with it and managed to incorporate a "Close Window" function into it using the following:

function closeit(){
document.getElementById('dwindow').style.display='none'
}

And calling it in the header DIV along with the X image in the corner like so:

<img src="closedr.gif" align="right" onClick="closeit()">

It works great for closing the window if not needed on the screen anymore.

Now I have been trying really hard to get a minimize/restore function to work with it was well so that when the minimize button is pressed, the second DIV (the content area) collapses and only the 1st DIV (the header area) remains.

Upon  pressing 'restore' the 2nd DIV is returned to its original shape and size.

I really need your help in making this happen - please can you kindly take some time to write the functions to minimize / restore the script?

Thanks
Aku

2) Angus Turnbull Group: Moderators
Posts: 4235 Joined: 7 Dec 2003 Location: New Zealand IP: 202.36.--.--
I'm glad you like the script!To "minimise", try something like this:

document.getElementById('dwindow').style.clip = 'rect(0  100% 20px 0)';

then to restore set it back to its initial clipping values or just 'auto'. Remember 'clip' is 'rect (top, right, bottom, left)' (although MSIE can have troubles with commas sometimes).

Good luck - Angus.

3) bilge Group: Guests
IP: 85.101.--.--
Hello Angus,
I really like your script and want to use it. I want to make the divs that I create draggable and resizable. I am calling the dragresize in the function:

function creatediv(){
        counter=counter+1;
        var  div=document.createElement("div");
        div["id"]="div_"+counter;
        document.body.appendChild(div);
        myStyle=div.style;
div.setAttribute("style",myStyle);
        myStyle.border="thin  groove";
        myStyle.width="404px"
        myStyle.height="158px"
        myStyle.position="absolute"
myStyle.left="60"
        myStyle.top="90"
        myStyle.background="white";
     

       dragresize.apply(document.getElementById("div_"+counter));
         }

but I does not even allow me create the div when I use the dragresize. Can you help me how I should use your script because it is just the thing that I want =)

4) Angus Turnbull Group: Moderators
Posts: 4235 Joined: 7 Dec 2003 Location: New Zealand IP: 203.109.--.--
If dragresize has already had apply() called on the document, you don't need to call it again, it'll automatically make all DIVs in the document with the right class names draggable. Try:

div.className = 'drsElement  drsHandle';

or apply the handle to a titlebar etc within the DIV.

- Angus.

Post a Reply:

You are not logged in, and will be posting anonymously as a guest. If you want to post using an account, please login at the top of this page.