0

I have two divs in my angular project. I want the two divs to have independent scroll bars.

The divs are constructed like this.

<div ng-show="$state.includes('base.videolist')||$state.includes('base.movielist')">
   <ul class="nav navbar-fixed-top roboto nav-tabs">
      <li ui-sref="base.videolist" ui-sref-active="active"><a>Videos</a></li>
      <li ui-sref="base.movielist" ui-sref-active="active"><a>Movies</a></li>
   </ul>
</div>

<div id="bvl" class="scrol_sctn"  ui-view="videolist" ng-init="pullFingerprintData()" ng-show="$state.includes('base.videolist')"></div>
<div id="bml" class="scrol_sctn"  ui-view="movielist" ng-show="$state.includes('base.movielist')"></div>
<div id="vpl" class="cdnfullscreen" ui-view="videoplayer" ng-show="$state.includes('base.videoplayer')"></div>

I want the divs bvl and bml to have independent scrolls. This is my css file.

body {
    background:#a5c8f3 !important;
    font-family: 'Raleway', sans-serif;
    padding-top: 50px;
    overflow: hidden;
}
.scrol_sctn { 
    margin:0; 
    padding:0;
    overflow-y: auto;
    overflow-x: hidden;
}

I hid the scroller for the body tag so that I can have independent tags for the bml and bvl tags. But doing this stops the entire page from using scrolls. Any help to achieve this is much appreciated.

4
  • I think if you add overflow-y: scroll into each particular div you will be able to do what you want. Commented Jan 17, 2017 at 17:28
  • Do you want me to change overflow-y: auto to scroll in the class scrol_sctn? I did that and it still the page isn't scrolling. Commented Jan 17, 2017 at 17:31
  • Take a look at this fiddle. Let me know if it is what you are looking for. I dont use AngularJS so I cant duplicate the code you have provided. Commented Jan 17, 2017 at 17:35
  • Yes. This is exactly what i need. Let me try to rip off the code that i use in html from angular and test the css in a plain setup and post the result Commented Jan 17, 2017 at 20:43

1 Answer 1

1

I added height to the child div and it started working as expected.

.scrol_sctn { 
    margin:30; 
    padding:100;
    height:100vh;
    overflow-y: scroll;
    overflow-x: hidden;
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.