2

I am applying css style to "body" and to a div which id is "overlay" like:

body
{
    margin:0;
    background:#FEFEFE url(../Images/gradientHeader1.png);
    background-repeat:repeat-x;
}

overLay
{
    background-color:#666666;
    height:1000px;
    left:0;
    opacity:0.5;
    position:absolute;
    margin-top:0;
    width:100%;
    z-index:1003;
}

"overLay" div is inside noscript tag which renders in the browser only when javascript is disabled in the browser.My requirement is that I have to set "overflow:hidden" in the body when "overLay" div get rendered.Can I set overflow property of the body from #overLay?or any other way?

0

2 Answers 2

2

Yes you can do this without scripting:

<noscript>
    <div id="overLay">whatever</div>
    <style type="text/css">
        body {
            overflow: hidden !important;
        }
    </style>
</noscript>

(You also need a # in your CSS rule: #overLay { ... })

Sign up to request clarification or add additional context in comments.

2 Comments

thanks for ur valuable advice.It works fine.But still my need is not compleatly fulfilled.When I use overflow:hidden scrollbar disappears but still key press down or page down works.I do not want the page to scroll down.Can u help me????
perhaps set the body height to a value?
0

You need to do it the other way around Set the body to what it needs to be when scripting is off and change it with javascript

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.