I am currently working on creating a custom push navigation system and I am using translateX to shift the content over to reveal the navigation menu.
However, I am facing an issue where I don't want the content to be completely pushed off screen, but instead have a small portion of it visible on the right side.
The challenge is that I can't set a fixed pixel value for this adjustment as it needs to adapt responsively. One idea I had was to translateX by 100% and then somehow bring it back by about 50px, but I'm struggling to implement this solution.
$(document).on('click','.wrapper span', function() {
$('.wrapper').addClass('active');
});
html, body {
height:100%;
}
.wrapper {
background:red;
height:100%;
}
.wrapper span {
width:50px;
height:50px;
background:yellow;
}
.wrapper.active {
transform:translateX(100%);
}
.navigation {
position:absolute;
background:#666666;
color:#ffffff;
top:0px;
left:0px;
bottom:0;
z-index:-1;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="wrapper">
i am a wrapper
<span>click me</span>
</div>
<div class="navigation">
i am a nav
</div>