PDA

View Full Version : losing control on DHTML WW



GriffinHeart
11-19-2008, 02:37 PM
Script: DHTML Window widget (v1.1)
http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/index.htm


Hello there, i want to use DHTML window widget, and i found something that isn't a bug but well i guess it could be made available:

An option to restrain the movement of the window to the size (width*height) of the parent.

When you move the window to the top and hide the top bar (drag bar), well basicaly you can't move it anymore losing any control on it, is there any way to restrain the movement to the size of the parent window?

Thank you.

jscheuer1
11-19-2008, 04:16 PM
Find this function in the script:


moveTo:function(t, x, y){ //move window. Position includes current viewpoint of document
this.getviewpoint() //Get current viewpoint numbers
t.style.left=(x=="middle")? this.scroll_left+(this.docwidth-t.offsetWidth)/2+"px" : this.scroll_left+parseInt(x)+"px"
t.style.top=(y=="middle")? this.scroll_top+(this.docheight-t.offsetHeight)/2+"px" : this.scroll_top+parseInt(y)+"px"
},

Make it like:


moveTo:function(t, x, y){ //move window. Position includes current viewpoint of document
this.getviewpoint() //Get current viewpoint numbers
t.style.left=(x=="middle")? this.scroll_left+(this.docwidth-t.offsetWidth)/2+"px" : this.scroll_left+parseInt(x)+"px"
t.style.top=(y=="middle")? this.scroll_top+(this.docheight-t.offsetHeight)/2+"px" : Math.max(0, this.scroll_top+parseInt(y))+"px"
},

and change:


move:function(t, e){
t.style.left=dhtmlwindow.distancex+dhtmlwindow.initx+"px"
t.style.top=dhtmlwindow.distancey+dhtmlwindow.inity+"px"
},

to:


move:function(t, e){
t.style.left=dhtmlwindow.distancex+dhtmlwindow.initx+"px"
t.style.top=Math.max(0, dhtmlwindow.distancey+dhtmlwindow.inity)+"px"
},