I am trying to create an effect similar to that of: background-attachment:fixed;
However I want to apply this affect to all elements contained within a div not just the background.
When you scroll down the div will move up the screen but it's contents some of which will be hidden in the overflow will come into view.
<div class="parent"> <!--- will move on scroll. Overflow hidden. --->
<div class="child"></div><!--- won't move on scroll --->
<div class="child"></div><!--- won't move on scroll --->
</div>
Ideally this will be a HTML and CSS solution, but I can stretch to some jQuery or DOM calls with JavaScript. Bear in mind that I would like to use this effect multiple times on one page, so it will need to be relatively succinct.
Apologies if this question has already been asked but I found it difficult to describe so perhaps I am using incorrect keywords in my searches. Any suggestions on how to better phrase this question will be appreciated.
Did you try to fix the position of a DIV:
<style type="text/css">
#mydiv{
position: fixed;
left: 10px;
top: 50px;
}
</style>
<div id="mydiv">
Some content here
</div>
It could be you needed.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments