homepage Welcome to WebmasterWorld Guest from 54.145.183.126
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
DHTML Window Scrollbar functions
riospace

5+ Year Member



 
Msg#: 4458480 posted 12:37 am on May 28, 2012 (gmt 0)

I want to have my dhtml popup window to have a scrollbar when the image goes below the fold so that the user can scroll down in the html window instead of scrolling down the underlying window to see the rest of the image below the fold.

If this can not be done automatically, then is there a way to set the vertical scrollbar to appear when an image is more than 500 px tall?

Here is the code:

if (typeof dhtmlwindow=="undefined")
alert('ERROR: Modal Window script requires all files from "DHTML Window widget" in order to work!')

var dhtmlmodal={
veilstack: 0,
open:function(t, contenttype, contentsource, title, attr, recalonload){
var d=dhtmlwindow //reference dhtmlwindow object
this.interVeil=document.getElementById("interVeil") //Reference "veil" div
this.veilstack++ //var to keep track of how many modal windows are open right now
this.loadveil()
if (recalonload=="recal" && d.scroll_top==0)
d.addEvent(window, function(){dhtmlmodal.adjustveil()}, "load")
var t=d.open(t, contenttype, contentsource, title, attr, recalonload)
t.controls.firstChild.style.display="none" //Disable "minimize" button
t.controls.onclick=function(){dhtmlmodal.close(this._parent, true)} //OVERWRITE default control action with new one
t.show=function(){dhtmlmodal.show(this)} //OVERWRITE default t.show() method with new one
t.hide=function(){dhtmlmodal.close(this)} //OVERWRITE default t.hide() method with new one
return t
},


loadveil:function(){
var d=dhtmlwindow
d.getviewpoint()
var theBody = document.getElementsByTagName("BODY")[0]
if (d.docheight > theBody.scrollHeight) {
this.docheightcomplete = d.docheight;
} else {
this.docheightcomplete = theBody.scrollHeight;
}
this.interVeil.style.width=d.docwidth+"px" //set up veil over page
this.interVeil.style.height=this.docheightcomplete+"px" //set up veil over page
this.interVeil.style.left=0 //Position veil over page
this.interVeil.style.top=0 //Position veil over page
this.interVeil.style.visibility="visible" //Show veil over page
this.interVeil.style.display="block" //Show veil over page
},

adjustveil:function(){ //function to adjust veil when window is resized
if (this.interVeil && this.interVeil.style.display=="block") //If veil is currently visible on the screen
this.loadveil() //readjust veil
},

closeveil:function(){ //function to close veil
this.veilstack--
if (this.veilstack==0) //if this is the only modal window visible on the screen, and being closed
this.interVeil.style.display="none"
},


close:function(t, forceclose){ //DHTML modal close function
t.contentDoc=(t.contentarea.datatype=="iframe")? window.frames["_iframe-"+t.id].document : t.contentarea //return reference to modal window DIV (or document object in the case of iframe
if (typeof forceclose!="undefined")
t.onclose=function(){return true}
if (dhtmlwindow.close(t)) //if close() returns true
this.closeveil()
},


show:function(t){
dhtmlmodal.veilstack++
dhtmlmodal.loadveil()
dhtmlwindow.show(t)
}
} //END object declaration


document.write('<div id="interVeil"></div>')
dhtmlwindow.addEvent(window, function(){if (typeof dhtmlmodal!="undefined") dhtmlmodal.adjustveil()}, "resize")

 

riospace

5+ Year Member



 
Msg#: 4458480 posted 1:04 am on May 28, 2012 (gmt 0)

I think what I really just need is to limit the height of the window. If I do this it will fix all of my problems. What is the best way to do this?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved