Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 737667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:44:51+00:00 2026-05-14T07:44:51+00:00

I’m trying to make ‘dark’ area when my modal window is opened. Here is

  • 0

I’m trying to make ‘dark’ area when my modal window is opened. Here is what I wrote: the first function f_documentSize will return size of the window, the second one will make fullwindow div.
It works great but there are scrollbars (vertical and horizontal). When I scroll them the page makes bigger (free space). Why?

function f_documentSize () {
    var n_scrollX = 0,
    n_scrollY = 0;

    if (typeof(window.pageYOffset) == 'number') {
        n_scrollX = window.pageXOffset;
        n_scrollY = window.pageYOffset;
    }
    else if (document.body && (document.body.scrollLeft || document.body.scrollTop )) {
        n_scrollX = document.body.scrollLeft;
        n_scrollY = document.body.scrollTop;
    }
    else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
        n_scrollX = document.documentElement.scrollLeft;
        n_scrollY = document.documentElement.scrollTop;
    }

    if (typeof(window.innerWidth) == 'number')
        return [window.innerWidth, window.innerHeight, n_scrollX, n_scrollY];
    if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
        return [document.documentElement.clientWidth, document.documentElement.clientHeight, n_scrollX, n_scrollY];
    if (document.body && (document.body.clientWidth || document.body.clientHeight))
        return [document.body.clientWidth, document.body.clientHeight, n_scrollX, n_scrollY];
    return [0, 0];
}

function f_putScreen (b_show) {
    if (b_show == null && !window.b_screenOn)
        return;

    if (b_show == false) {
        window.b_screenOn = false;
        if (e_screen) e_screen.style.display = 'none';
        return;
    }

    if (window.e_screen == null) {
        window.e_screen = document.createElement("div");
        e_screen.innerHTML = " ";
        document.body.appendChild(e_screen);

        e_screen.style.position = 'absolute';
        e_screen.id = 'eScreen';

        if (document.addEventListener) {
            window.addEventListener('resize', f_putScreen, false);
            window.addEventListener('scroll', f_putScreen, false);
        }
        if (window.attachEvent) {
            window.attachEvent('onresize', f_putScreen);
            window.attachEvent('onscroll', f_putScreen);
        }
        else {
            window.onresize = f_putScreen;
            window.onscroll = f_putScreen;
        }
    }

    // set properties
    var a_docSize = f_documentSize();
    e_screen.style.left = a_docSize[2] + 'px';
    e_screen.style.top = a_docSize[3] + 'px';
    e_screen.style.width = a_docSize[0] + 'px';
    e_screen.style.height = a_docSize[1] + 'px';
    e_screen.style.zIndex = 1000;
    e_screen.style.display = 'block';
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T07:44:51+00:00Added an answer on May 14, 2026 at 7:44 am

    Try setting the “modal background” DIV’s display style to position:absolute and set its left, top, right, and bottom properties to 0. Also make sure its margin is 0.

    #modalDiv {
      position:absolute;
      background-color: #CCCCCC;
      -moz-opacity: 0.5;
      opacity: 0.5;
      filter:alpha(opacity=50);
      left: 0;
      top: 0;
      right: 0;
      bottom: 0;
      margin: 0;
      z-index: 9999 /* where  10K is the dialog and 9999 > everything else */
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.