Results 1 to 7 of 7

Thread: How to get rid of vertical scrollbar for dhtml window

  1. #1
    Join Date
    Jun 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to get rid of vertical scrollbar for dhtml window

    1) Script Title:

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

    3) Describe problem:
    I am using the dhtml window to show content in our application when user clicks on a link. Initially, the page content is not known and it is dynamically loaded. The option used for content source is "Iframe". I do not want the vertical scroll bar to be shown and the div should resize itself according to the content.
    It would be helpful if somebody can help me with this.

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Hmm is the page inside the DHTML window on the same domain as the page launching the DHTML window, or an external URL (ie: http://google.com)?
    DD Admin

  3. #3
    Join Date
    Jun 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    The DHTML window and the page launching it are in the same domain.

  4. #4
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    One approach is to dynamically resize the DHTML window after the contained page has loaded, by getting the dimensions of this page. This has only been tested in FF so far, but inside dhtmlwindow.js, try adding the code in red below after the following existing line:

    Code:
    		window.frames["_iframe-"+t.id].location.replace(contentsource) //set location of iframe window to specified URL
    		this.addEvent(window.frames["_iframe-"+t.id], function(){
    			try{
    				var wbody=this.document.body
    				t.setSize(wbody.offsetWidth, wbody.offsetHeight)
    			} catch(e){}
    		}, "load")
    DD Admin

  5. #5
    Join Date
    Jun 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for the code. But this does not work in IE and Safari. If you can share the code which shall work across these browsers.

  6. #6
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Hmm might still be a work in progress, but try the below modified .js file.
    DD Admin

  7. #7
    Join Date
    Jun 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    The attached file also did not help resizing the iframe.

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
  •