PDA

View Full Version : DHTML Window Widget fix positions of minimized windows



antonyf
08-02-2011, 09:01 AM
1) Script Title:
DHTML Window Widget
2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/index.htm
3) Describe problem:
Hi i am trying to get the minimized window in a fixed position at the bottom of the .php page. I like its current position when it is minimised, it sits at the bottom left of the page--- The problem that i am having is that when the page is tall/or height is big, and the page is scrolled, the minimised window also scrolls out of sight..
Is there away to get the minimised window fixed in its current position, so when the page scrolls the window/s remain at the bottom of the page?

I have no code-- i did find this in the .js file

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"
},

// i don't really need the windows to drag if this helps, also i have multiple windows opening, so i aslo dont want to loose the windows positioned next to each other when minimized..
Thanks in advance.

PS: i also have to add!! i dont have a fixed name for the dhtml window: IE:

<a href="#" onClick="divwin=dhtmlwindow.open('divbox', 'div', '{DIVNAME}', '{DIVNAME}', 'width=450px,height=300px,left=200px,top=150px,resize=1,scrolling=1'); return false">

// the name variable and the window title are $output by the internal .php file to the html file.. if this helps

jscheuer1
08-03-2011, 05:23 AM
Try this out. In dhtmlwindow.js replace the getviewpoint function (starts at line 186) with this one:


getviewpoint:function(){ //get window viewpoint numbers
var ie=false, browserver=7;
/*@cc_on @*//*@if(@_jscript_version >= 5)ie = true; browserver = /MSIE (\d+)/.exec(navigator.userAgent)[1];@end @*/
var domclientWidth=document.documentElement && parseInt(document.documentElement.clientWidth) || 100000 //Preliminary doc width in non IE browsers
this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
this.scroll_top=browserver<7? this.standardbody.scrollTop : 0;
this.scroll_left=browserver<7? this.standardbody.scrollLeft : 0;
this.docwidth=(ie)? this.standardbody.clientWidth : (/Safari/i.test(navigator.userAgent))? window.innerWidth : Math.min(domclientWidth, window.innerWidth-16)
this.docheight=(ie)? this.standardbody.clientHeight: window.innerHeight
},

In the dhtmlwindow.css file, change the position to fixed at the beginning here:


.dhtmlwindow{
position: fixed;
border: 2px solid black;
visibility: hidden;
background-color: white;
}

.drag-handle{ /*CSS for Drag Handle*/
padding: 1px;
text-in . . .

On the page(s) with this script, place this conditional stylesheet as shown, after the link for the dhtmlwindow.css stylesheet:


<link rel="stylesheet" href="windowfiles/dhtmlwindow.css" type="text/css" />
<!--[if lt IE 7]>
<style type="text/css">
.dhtmlwindow {
position: absolute;
}
</style>
<![endif]-->
<script type="text/javascript" src="windowfiles/dhtmlwindow.js">

/***********************************************
* DHTML Window Widget- Dynamic Drive (www.dynamicdrive.com)
* This notice must stay int . . .

The windows, whether full size or minimized will now be fixed. You cannot scroll them out of view. But you can still drag them around.

Except that is for IE 6 and less. In those browsers things will be the same as they were.

antonyf
08-05-2011, 12:52 PM
Hi, apologies for the delayed reply.
The fix you gave works perfectly!, even better then i imagined it:D..
Thanks John.

PS: If i have multiple windows opening on the same page-- is it possible to have them open at the bottom where the "minimised windows" is positioned, and next to each other by default?

IE: if a user open a window, and then opens another, or multiple more windows, they will position themselves by default alongside each other on opening?
If you too bussy, i can try to figure this one out on my own.. at the moment the windows position is determined by the link:
dhtmlwindow.open("googlebox", "iframe", "link/url", "#1: Google Web site", "width=590px,height=350px,left=2px, top=1px,resize=0,scrolling=0,center=0", "recal"),
but if i have multiple windows they open behind each other on the top--
I would like to get them positioned at bottom of page alongside each other..

only if you have time..
Thanks again for the fix:D works great!
regards
Tony

green
10-24-2011, 10:53 PM
I'm very interested in the work John Scheuer did on the dhtml window to get it to assume a fixed position on screen.

Works fine in Safari and FF but disappears when window scrolled in IE8 and won't even be dragged and in Opera 11.5 the window shoots to the left when you try to drag it. Can the code be tweaked to get it working in all these 4 browsers?

I'd very much appreciate it.:)

antonyf
11-10-2011, 11:04 PM
Hi Green,
I got your email - - didn't get a reply address. The fix that John gave me here worked perfectly for me.
The window dragging problem you spoke about i didn't get any such problems AFTER i added the If IE fix that he included in the fix above.. Every thing worked perfectly.

Double check your code.. and where you added it, and just a guess maybe you using the other version of the DHTML window script?

But i would say for sure that you need to check the if IE fix.. and maybe your html page format.. (at a guess!)
let me know.
Regards
Tony

green
11-11-2011, 12:05 PM
Thanks, Antony, for replying here at the forum.

Firstly, I'm glad the script is working fine. That's what I really wanted to know. Now I know it's some flaw with my pages or js files. Just seemed strange it works perfectly with Chome, FF and Safari yet not with IE8. By the way, HAVE you tested this with IE8?

I'll start going through everything and post back if the error correction (if I find it) could be useful for other users.

Cheers,

Mike

green
11-13-2011, 04:31 PM
Have resolved the problem so that modified fixed window script by John Scheuer now works properly in IE8. I mention it for others who might make the same and understandable error.

The script requires the following DOCTYPE for it to work correctly in all main browsers. I had copied the script into existing pages with a different DOCTYPE and couldn't comprehend why it failed to work.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">

Thanks.:)