I have animated ng-view
. I'm using slideup animation, which requires absolute position of elements and also overflow-x: hidden
to clip the content. In one sub-page I have to use scrollTo
element functionality, but it doesn't work if both 2 values are specified.
Here is a main ng-view
class which is required for correct animations
.wrapper {
position: absolute !important;
left: 0;
top: 0;
height: 100%;
min-height: 100%;
min-width: 100%;
overflow-x: hidden;
}
And structure:
<div class="wrapper ng-view-div">
<nav>
<ul>
<li><a href du-smooth-scroll="section-1" du-scrollspy>Section 1</a></li>
<li><a href du-smooth-scroll="section-2" du-scrollspy>Section 2</a></li>
<li><a href du-smooth-scroll="section-3" du-scrollspy>Section 3</a></li>
</ul>
</nav>
<section id="section-1" style="background-color: red">
C
</section>
<section id="section-2" style="background-color: blue">
C
</section>
<section id="section-3" style="background-color: green">
C
</section>
</div>
I prepared plnkr to easily show how it looks like for now. Is there any other way to achieve scroll working but with this two values ?
Adding the parent element with position:relative; solves the problem. In order to have absolute positioned “wrapper img” work with the property of overflow: hidden, position the parent element “wrapper” to relative.
To change this, set the min-width or min-height property.” This means that a flex item with a long word won't shrink below its minimum content size. To fix this, we can either use an overflow value other than visible , or we can set min-width: 0 on the flex item.
The overflow-x CSS property sets what shows when content overflows a block-level element's left and right edges. This may be nothing, a scroll bar, or the overflow content.
Use overflow: hidden instead. Use overflow-x : scroll and overflow-y : hidden , or overflow: scroll hidden instead.
Here, height:100% in the wrapper CSS class creates an issue. Please use the wrapper CSS class below.
.wrapper {
position: absolute !important;
left: 0;
top: 0;
min-height: 100%;
min-width: 100%;
overflow-x: hidden;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With