How to detect scroll from inner page and apply if statement logic if page is not scrolled?
Hello,
I am a bit struggling on this one.
I have build an app with Jquery and would like to detect the scrolling on the mobile so I can hide or show my navbar.
My first problem is this code example from the jquery website:
- $( "#target" ).scroll(function() {
- $( "#log" ).append( "<div>Handler for .scroll() called.</div>" );
- });
The problem in this example, it does not show how to apply an "if" statement if the page is scrolled or NOT scrolled.
ie:
- If(pageIsScrolled){
- app.navbar.hide('.navbar');
- }else{
- app.navbar.show('.navbar');
- }
The second problem is the page itself. I am not loading single pages but instead loading my pages inside another element like this:
- <div class="page">
- <div class="page-content">
- <div class="row">
- <div class="col-10"></div>
- <div class="col-80 align-content-center">
- <div class="top-space"></div>
- <img src="img/logo.png" width="100%" class="animated fadeIn" />
- <div class="bottom-space"></div>
- </div>
- <div class="col-10"></div>
- </div>
- <div id="load-pages"></div> <------Here
- </div>
- </div>
And i am not sure how can jquery detect the scrolling of an inner page,
Any idea how to fix both issues please?
I am using Cordova and Jquery.
Thanks,