Solved

Having a Div overlap other divs, but still scroll with the page.

Posted on 2011-09-27
6
238 Views
Last Modified: 2012-05-12
I am trying to get a div tag that I have overlapping other divs with the "z-index" and 'position' rules. Everything looks good except the div stays put even when the page scrolls. Is there a way to get this fixed position div to scroll with the rest of the page?
0
Comment
Question by:RNB
  • 3
  • 2
6 Comments
 
LVL 5

Expert Comment

by:Rainverse
ID: 36711646
0
 

Author Comment

by:RNB
ID: 36711774
@Rainverse:

I want the fixed div to scroll. On the link you sent the navigation box stays where it is and the page scrolls behind it. I want the fixed div to scroll with the page.
0
 
LVL 5

Expert Comment

by:Rainverse
ID: 36711801
You want the content in the div to scroll while the main window is scrolling. Am I understanding you now?

-MJC
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:RNB
ID: 36711897
@ Rainverse:

Yea I am only using this method for its overlapping capabilities. I do want it to scroll with the rest of the page though.
0
 
LVL 5

Expert Comment

by:Rainverse
ID: 36712056
Try this javascript:

window.onscroll = function () {
  document.getElementById("divID").scrollTop = document.body.scrollTop;
}

Open in new window


-MJC
0
 
LVL 7

Accepted Solution

by:
Alicia St Rose earned 250 total points
ID: 36720194
Hi RNB,
Looks like your parent div needs: position: relative;
You need to have your absolute positioned div relative to the next outside div. Right now it sounds like your div is positioned relative to the browser window. Once you add this code you will have to adjust your top: ,  left: , bottom: , right: , (whichever ones you used). Because now it will be using the parent div as a reference.

Do you have some code or a Url we can look at?
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now