Results 1 to 2 of 2

Thread: losing control on DHTML WW

  1. #1
    Join Date
    Nov 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default losing control on DHTML WW

    Script: DHTML Window widget (v1.1)
    http://www.dynamicdrive.com/dynamici...ndow/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.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Find this function in the script:

    Code:
    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:

    Code:
    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:

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

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

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •