[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

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

Posted on 2011-09-27
6
Medium Priority
?
248 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 8

Accepted Solution

by:
Alicia St Rose earned 1000 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

650 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