CSS slide-out menu issue

2.7k Views Asked by At

Im using topcoat (topcoat.io), backbone.js and Phonegap for a mobile app Im builing. I want to create a Facebook style slide-out menu. Here is a link to the tutorial: http://outof.me/navigation-drawer-pattern-with-topcoat-css-library/

Here is the jsfiddle which works fine: http://jsfiddle.net/webintelligence/vPef6/1/

Essentially it looks like:

<body>
    <div class="topcoat-navigation-bar">
         ...
    </div>

   <nav class="side-nav">
        ...
   </nav>

   <div class="main-content">In the content</div>
</body>

The important css is:

body{
    font-family: source-sans-pro, sans-serif;
    position: relative;
    width: 100%;
    height:100%;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

.side-nav {
    display:block;
    position:absolute;
    top:0;
    left:0;
    width:320px;
    height:100%;
    background-color:#353535;
}

.main-content {
    position: absolute;
    background: inherit;
    left: 0;
    padding-top:4rem;
    width:100%;
    height:100%;
    transition: left 0.2s ease-out;
    -webkit-transition: left 0.2s ease-out;
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    -moz-box-shadow: 0px 0px 8px 2px rgba(0, 0, 0, 0.57);
    -webkit-box-shadow: 0px 0px 8px 2px rgba(0, 0, 0, 0.57);
    box-shadow: 0px 0px 8px 2px rgba(0, 0, 0, 0.57);
}

Because my application contains many templates which are transitioned in and out (with the help of this simple library: https://github.com/ccoenraets/PageSlider), I need to have a tag after the body and around the content. However, when I do this, the menu can be seen behind the main content. Here is the jsfiddle: http://jsfiddle.net/webintelligence/TLNyY/

I have added css for the div (copying the body css):

div.current-page{
    margin:0;
    padding:0;
    height: 100%;
    font-family: source-sans-pro, sans-serif;
    position: relative;
    width: 100%;
    height:100%;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

Any ideas why the menu is now showing through the content?

1

There are 1 best solutions below

0
On BEST ANSWER

change background from .main-content

for example:

background: inherit;

to

background: white;

DEMO: Fiddle