Jump to content

Recommended Posts

I created a javascript function that covers the entire screen with a semi transparent black png when a user clicks a button to pop up a dialog box. problem is, the png doesn't repeat to cover the entire web page. it covers the entire width of the page and the entire height of the computer screen, but when you scroll down, the png stops repeating. hope you guys know what im talking about but heres my css for the div that holds that transparent png.

background-image: url(../images/template/faded-bg.png);
background-repeat: repeat;
top: 0px;
left: 0px;
position: absolute;
display: none;
width: 100%;
height: 100%;
background-attachment: fixed;

 

background-attachment does nothing. i tried both fixed and scroll but no luck.

anyone know how to fix this problem?

Link to comment
https://forums.phpfreaks.com/topic/236498-need-css-help-for-javascript-function/
Share on other sites

Change position absolute in to

position:fixed;

 

and remove the background-attachment property, (since that is not what it's meant for).

 

if you want this to work for ie6 and lower, you will need to use javascript to mimic te fixed property.

 

Instead of the above you could also use javascript to get the height of the document and set that as the height of the div. That is something else than setting it to 100%.

Change position absolute in to

position:fixed;

 

and remove the background-attachment property, (since that is not what it's meant for).

 

if you want this to work for ie6 and lower, you will need to use javascript to mimic te fixed property.

 

Instead of the above you could also use javascript to get the height of the document and set that as the height of the div. That is something else than setting it to 100%.

 

 

OMG Thank you so much!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.