Check documentation for the latest version of dhtmlxSuite screenDim DHTMLX Docs

screenDim

returns top/bottom coords for visible screen area including scrolls

object screenDim();
objecttop and bottom coords

Example

// necessary to show div under input,
// if no space at bottom - over input
// assuming div.style.position = "absolute"
 
// your custom div used as popup for input
var div = document.getElementById("customDivId");
 
// your custom input
var input = document.getElementById("customInputId");
 
// get screen res
var dim = window.dhx.screenDim(); // dim = {top: some_value, bottom: some_value}
 
// 1st attempt, show under
var inputY = window.dhx.absTop(input);
var divY = inputY+input.offsetTop;
 
// check if space at bottom not allowed to insert div
if (divY + div.offsetHeight > dim.bottom) {
    divY = inputY-div.offsetHeight;
    // extra check
    if (divY < dim.top) {
        // ooops! small page height
        // here you need to choose "smallest evil"
    }
}
 
// finally
div.style.top = divY+"px";
div.style.width = input.offsetWidth+"px";

Back to top