Building a website with Zurb Foundation, I am using the off-canvas feature.
The default width of the off-canvas areas is 250px and I would like to increase it to, let's say, 600px.
Unfortunately, when I increase the width of the off-canvas, it becomes visible while loading...
Also, I noticed that when you expand or close the off-canvas, if it's bigger than 250px the "slide" works for 250px only.
Here's the HTML code to test:
<!doctype html>
<html class="no-js" lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Foundation for Sites</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.5.3/css/foundation.min.css">
<style>
#off-canvas-right {
width: 600px;
}
</style>
</head>
<body>
<div class="off-canvas position-left" id="off-canvas-left" data-off-canvas>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad cumque, eligendi. Deleniti rerum, distinctio tempora laboriosam velit incidunt hic asperiores officiis alias ea, sequi libero animi soluta totam, quia veritatis.
</div>
<div class="off-canvas position-right" id="off-canvas-right" data-off-canvas>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolore voluptate velit, labore, voluptatem quia laborum temporibus asperiores at eos nulla nam ab fugit tenetur quaerat iusto architecto eum ea explicabo.
</div>
<div class="off-canvas-content" data-off-canvas-content>
<a data-open="off-canvas-left" class="text-center">Open left</a>
<a data-open="off-canvas-right" class="text-center">Open right</a>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.5.3/js/foundation.min.js"></script>
<script>
$(document).foundation();
</script>
</body>
</html>
Any idea that would help solve these 2 issues?
You just need to add the CSS for transitioning in all states. I think this is also what's causing the jump in view on page load too. I believe that adding this to your styles will work:
#off-canvas-right {
&.off-canvas {
width: 600px;
transform: translateX(600px);
&.is-open {
transform: translate(0, 0);
}
}
}
Here's a link to a working CodePen