Make navbar transparent and allow page content to start from top of screen

Thanks. This doesn’t solve the problem of the previous page’s navbar being affected by the transparency. ( this problem is iOS only ).

just consider that in ios-theme
this :

<div class="navbar">
  <div class="navbar-inner">
  </div>
</div>

is equivalent to this :

<template>
  <div class="navbar-inner">
  </div>
</template>

and everything will be clear to you

Why is this? So what you’re saying is that $$(’.navbar’) is not targeting what I think it is?

The reason it so obvious for me on the iOS theme is because my previous page is a list and when scrolled down there’s content behind the navbar. This content then flickers in sight before the page transitions on the page where I want the transparent navbar.

this page :

<div class="page my-page-class">
  <div class="navbar you-not-gonna-see-this-class">
    <div class="navbar-inner my-navbar-class">
    </div>
  </div>
  <div class="page-content"></div>
</div>

will be parsed like this :

<div class="navbar">
  <div class="navbar-inner my-navbar-class">
  </div>
</div>
<div class="page my-page-class">
  <div class="page-content"></div>
</div>

my example works ok on kitchen-sink

try this :

    pageAfterIn:function(e,page){
      page.route.route.setNavbar(page,'transparent'); 
    }, 

I’m essentially doing the same thing by doing this:

 // Script
pageBeforeIn: function (e, page) {
    page.$navbarEl.parent().addClass('navbar-transparent no-hairline');
  },
  pageBeforeOut: function (e, page) {
    page.$navbarEl.parent().removeClass('navbar-transparent no-hairline');
  },

// CSS
.navbar-transparent {
  background: transparent !important;
}

But the result is still that the previous navbar is changed before transitioning out. Nothing is working, maybe @nolimits4web can shed some light.

use (pageMounted || pageInit || pageBeforeIn || pageAfterIn) to addClass
and (pageBeforeOut || pageAfterOut || pageBeforeRemove) to removeClass

You likely need to set transition-duration: 400ms to navbar for iOS theme. So it is a same navbar for app pages, so it should change its background opacity for this duration to get more smooth behavior

Where should I set the style? Are you suggesting just adding the general css rule?

.ios .navbar {
  transition-duration: 400ms;
}

I don’t notice a difference, either way, it still makes the transitions feel really clunky. Is there no way to just have the page I’m transitioning to go over the previous page including the navbar.?

Can you please provide a JSFiddle with minimal setup to what you are trying to do?

Here you go:

https://jsfiddle.net/juliusbangert/q1evhxrt/5/

I had to fill out the list page to demonstrate the effect I’m describing… so if you scroll down the list before transitioning to the next page you’ll see what I mean about the glitchy nav bar transparency.

Sorry the jsFiddle is a bit convoluted, wanted to clean it up with handlebar syntax but couldn’t get that working.
The transitions are happening faster in my browser so the problem is more apparent when running on an iOS device.

Something like https://jsfiddle.net/cqqzp5zo/

Is it not possible to just have the new page content slide over the previous pages navbar?

Possible by setting iosDynamicNavbar: false in router settings, then it won’t use single navbar for pages

I was playing around with that on Friday. Is it possible to just disable it for one particular page transition but keep the iosDynamicNavbar everywhere else ?

No, it won’t work, because whole app structure depends on it. You can just disable navbar for single page by adding no-navbar class to the page and implement your own element on this page

I think that is probably the best option for now, feels a bit hacked but I think I’ll do this for now. Is there a recommended implementation of this if I have a pull-to-refresh on the page?

How do I use pull-to-refresh with .no-navbar class? I see in the css there is a class and styles for .ptr-no-navbar.

I want to have no navbar as I discussed above, but I also want the pull to refresh functionality.

I asked this as a separate question because I thought it was enough of a new topic.

In CSS, there is no property such as transparancy. But, you can achieve transparancy by inserting a pseudo element with regular opacity the exact size of the element behind it. The CSS3 property for transparent is opacity and it is a part of the W3C CSS3 recommendation.

div
{
  opacity: 0.6;
}

The opacity-level describes the transparency-level, it ranges from 0.0 to 1.0. The level 0.0 is completely transparent, 0.5 is 50% see-through and level 1.0 is not transparent. Opacity has a default initial value of 1 (100% opaque).