PDA

View Full Version : DHTML Window Widget help



DinoCow
08-26-2008, 02:54 AM
1) Script Title: DHTML Window Widget

2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...dhtmlmodal.htm

3) Describe problem:
When a link is clicked, a window opens up with a Flash-based music player. When it is playing music and you click Minimize, the music stops playing. Why? How do I make it so it does not stop? Can I use the hide() function or do I have to fiddle with the Javascript code in some way? I don't know JS much so any help would be appreciated.

Nile
08-26-2008, 03:06 AM
Find this in your js:


minimize:function(button, t){
dhtmlwindow.rememberattrs(t)
button.setAttribute("src", dhtmlwindow.imagefiles[2])
button.setAttribute("title", "Restore")
t.state="minimized" //indicate the state of the window as being "minimized"
t.contentarea.style.display="none"
t.statusarea.style.display="none"
if (typeof t.minimizeorder=="undefined"){ //stack order of minmized window on screen relative to any other minimized windows
dhtmlwindow.minimizeorder++ //increment order
t.minimizeorder=dhtmlwindow.minimizeorder
}
t.style.left="10px" //left coord of minmized window
t.style.width="200px"
var windowspacing=t.minimizeorder*10 //spacing (gap) between each minmized window(s)
t.style.top=dhtmlwindow.scroll_top+dhtmlwindow.docheight-(t.handle.offsetHeight*t.minimizeorder)-windowspacing+"px"
},


And change it to this:


minimize:function(button, t){
dhtmlwindow.rememberattrs(t)
button.setAttribute("src", dhtmlwindow.imagefiles[2])
button.setAttribute("title", "Restore")
t.state="minimized" //indicate the state of the window as being "minimized"
t.contentarea.style.visibility="none"
t.statusarea.style.visibility="none"
if (typeof t.minimizeorder=="undefined"){ //stack order of minmized window on screen relative to any other minimized windows
dhtmlwindow.minimizeorder++ //increment order
t.minimizeorder=dhtmlwindow.minimizeorder
}
t.style.left="10px" //left coord of minmized window
t.style.width="200px"
var windowspacing=t.minimizeorder*10 //spacing (gap) between each minmized window(s)
t.style.top=dhtmlwindow.scroll_top+dhtmlwindow.docheight-(t.handle.offsetHeight*t.minimizeorder)-windowspacing+"px"
},

DinoCow
08-26-2008, 03:10 AM
You are truly awesome. Thank you so very much for your help! It worked like charm. :D

Have a great day.

Nile
08-26-2008, 03:13 AM
@DinoCow
Night for me. :) Glad to help

DinoCow
08-26-2008, 03:18 AM
Hmm. It looks like the contentarea.style. line is the cause of the problem. Weird thing is that when I minimize the window now, the content still shows attached to the bottom of the minimized window title bar... I tried adding a t.style.height="17px" line under the .width line, but that did not solve it. Any suggestions?

Nile
08-26-2008, 09:54 PM
Change:


restore:function(button, t){
dhtmlwindow.getviewpoint()
button.setAttribute("src", dhtmlwindow.imagefiles[0])
button.setAttribute("title", "Minimize")
t.state="fullview" //indicate the state of the window as being "fullview"
t.style.display="block"
t.contentarea.style.display="block"
if (t.resizeBool) //if this window is resizable, enable the resize icon
t.statusarea.style.display="block"
t.style.left=parseInt(t.lastx)+dhtmlwindow.scroll_left+"px" //position window to last known x coord just before minimizing
t.style.top=parseInt(t.lasty)+dhtmlwindow.scroll_top+"px"
t.style.width=parseInt(t.lastwidth)+"px"
},

To:


restore:function(button, t){
dhtmlwindow.getviewpoint()
button.setAttribute("src", dhtmlwindow.imagefiles[0])
button.setAttribute("title", "Minimize")
t.state="fullview" //indicate the state of the window as being "fullview"
t.style.visibility="visible"
t.contentarea.style.display="visible"
if (t.resizeBool) //if this window is resizable, enable the resize icon
t.statusarea.style.display="visible"
t.style.left=parseInt(t.lastx)+dhtmlwindow.scroll_left+"px" //position window to last known x coord just before minimizing
t.style.top=parseInt(t.lasty)+dhtmlwindow.scroll_top+"px"
t.style.width=parseInt(t.lastwidth)+"px"
},


And then change the code I gave you above to this:


minimize:function(button, t){
dhtmlwindow.rememberattrs(t)
button.setAttribute("src", dhtmlwindow.imagefiles[2])
button.setAttribute("title", "Restore")
t.state="minimized" //indicate the state of the window as being "minimized"
t.contentarea.style.visibility="hidden"
t.statusarea.style.visibility="hidden"
if (typeof t.minimizeorder=="undefined"){ //stack order of minmized window on screen relative to any other minimized windows
dhtmlwindow.minimizeorder++ //increment order
t.minimizeorder=dhtmlwindow.minimizeorder
}
t.style.left="10px" //left coord of minmized window
t.style.width="200px"
var windowspacing=t.minimizeorder*10 //spacing (gap) between each minmized window(s)
t.style.top=dhtmlwindow.scroll_top+dhtmlwindow.docheight-(t.handle.offsetHeight*t.minimizeorder)-windowspacing+"px"
},

DinoCow
08-27-2008, 02:34 AM
Thanks for your help, Nile! I don't think I'd ever figure this out on my own.

I think you've just about fixed this problem... it minimizes, but the minimized window still shows the content, although now it's all contained within the window instead of the content just jutting out like a tail.

Maybe it's easier to understand if you saw the source of the problem:
http://www.dinocow.net/ (http://www.dinocow.net)
(I'm an amateur at web design, please don't laugh at me. :-P )

The link I'm most concerned with is the Music box, which is the mid-right icon (piano keyboard).

One oddity of great interest that I noticed earlier, before the most recent changes you made, when the content was jutting outside of the window's bottom borders ("like a tail") and I clicked on the window's title bar to move it around, the content portion would disappear when my mouse was clicked on the title bar and then would reappear when I let go of it. Do you think that could be used to make the content disappear permanent while the window is minimized?

Thanks again for your generous help.

Nile
08-27-2008, 02:42 AM
I've tried my best, lol. Looked at the code, I don't have a clue, I'm sorry.

DinoCow
08-27-2008, 03:00 AM
No need to be sorry. You've helped a great deal. Thanks again and have a great day!