Reputation: 67
Sorry for a noob question. I'm not good at css but how to make foundation framework off canvas look flat? It seems has a gradient at the very edge that makes it look like a 3D and I don't like it. Thanks for the answer!
I edited my question, added my code so you can visualize it.
I actually having 2 problems here, first, I want to make my off-canvas flat.. I searched through foundation.css all the elements with off-canvas and put it here. What do you think should I change?
and second is when I open this codes on mozilla off-canvas closes by itself everytime I clicked a menu that's link to an id.. but not in chrome..
this is my first time to try foundation. thanks again for the answer!
$(document).foundation();
$(".sub-menu").hide();
$(".main-menu").on("click", function(){
if($(this).hasClass('active')) {
$(this).next('.sub-menu').slideToggle();
} else {
$(".main-menu").removeClass('active');
$(this).addClass('active');
$(".sub-menu").slideUp();
$(this).next('.sub-menu').slideDown();
}
});
.sub-menu li
{
list-style-type: none;
}
.off-canvas-wrap {
-webkit-backface-visibility: hidden;
position: relative;
width: 100%;
overflow: hidden; }
.off-canvas-wrap.move-right, .off-canvas-wrap.move-left {
min-height: 100%;
-webkit-overflow-scrolling: touch; }
.left-off-canvas-menu {
-webkit-backface-visibility: hidden;
width: 15.625rem;
top: 0;
bottom: 0;
position: absolute;
overflow-x: hidden;
overflow-y: auto;
background: #333333;
z-index: 1001;
box-sizing: content-box;
transition: transform 500ms ease 0s;
-webkit-overflow-scrolling: touch;
-ms-overflow-style: -ms-autohiding-scrollbar;
-ms-transform: translate(-100%, 0);
-webkit-transform: translate3d(-100%, 0, 0);
-moz-transform: translate3d(-100%, 0, 0);
-ms-transform: translate3d(-100%, 0, 0);
-o-transform: translate3d(-100%, 0, 0);
transform: translate3d(-100%, 0, 0);
left: 0; }
.left-off-canvas-menu * {
-webkit-backface-visibility: hidden; }
.right-off-canvas-menu {
-webkit-backface-visibility: hidden;
width: 15.625rem;
top: 0;
bottom: 0;
position: absolute;
overflow-x: hidden;
overflow-y: auto;
background: #333333;
z-index: 1001;
box-sizing: content-box;
transition: transform 500ms ease 0s;
-webkit-overflow-scrolling: touch;
-ms-overflow-style: -ms-autohiding-scrollbar;
-ms-transform: translate(100%, 0);
-webkit-transform: translate3d(100%, 0, 0);
-moz-transform: translate3d(100%, 0, 0);
-ms-transform: translate3d(100%, 0, 0);
-o-transform: translate3d(100%, 0, 0);
transform: translate3d(100%, 0, 0);
right: 0; }
.right-off-canvas-menu * {
-webkit-backface-visibility: hidden; }
ul.off-canvas-list {
list-style-type: none;
padding: 0;
margin: 0; }
ul.off-canvas-list li label {
display: block;
padding: 0.3rem 0.9375rem;
color: #999999;
text-transform: uppercase;
font-size: 0.75rem;
font-weight: bold;
background: #444444;
border-top: 1px solid #5e5e5e;
border-bottom: none;
margin: 0; }
ul.off-canvas-list li a {
display: block;
padding: 0.66667rem;
color: rgba(255, 255, 255, 0.7);
border-bottom: 1px solid #262626;
transition: background 300ms ease; }
ul.off-canvas-list li a:hover {
background: #242424; }
.move-right > .inner-wrap {
-ms-transform: translate(15.625rem, 0);
-webkit-transform: translate3d(15.625rem, 0, 0);
-moz-transform: translate3d(15.625rem, 0, 0);
-ms-transform: translate3d(15.625rem, 0, 0);
-o-transform: translate3d(15.625rem, 0, 0);
transform: translate3d(15.625rem, 0, 0); }
.move-right .exit-off-canvas {
-webkit-backface-visibility: hidden;
transition: background 300ms ease;
cursor: pointer;
box-shadow: -4px 0 4px rgba(0, 0, 0, 0.5), 4px 0 4px rgba(0, 0, 0, 0.5);
display: block;
position: absolute;
background: rgba(255, 255, 255, 0.2);
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: 1002;
-webkit-tap-highlight-color: transparent; }
@media only screen and (min-width: 40.063em) {
.move-right .exit-off-canvas:hover {
background: rgba(255, 255, 255, 0.05); } }
.move-left > .inner-wrap {
-ms-transform: translate(-15.625rem, 0);
-webkit-transform: translate3d(-15.625rem, 0, 0);
-moz-transform: translate3d(-15.625rem, 0, 0);
-ms-transform: translate3d(-15.625rem, 0, 0);
-o-transform: translate3d(-15.625rem, 0, 0);
transform: translate3d(-15.625rem, 0, 0); }
.move-left .exit-off-canvas {
-webkit-backface-visibility: hidden;
transition: background 300ms ease;
cursor: pointer;
box-shadow: -4px 0 4px rgba(0, 0, 0, 0.5), 4px 0 4px rgba(0, 0, 0, 0.5);
display: block;
position: absolute;
background: rgba(255, 255, 255, 0.2);
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: 1002;
-webkit-tap-highlight-color: transparent; }
@media only screen and (min-width: 40.063em) {
.move-left .exit-off-canvas:hover {
background: rgba(255, 255, 255, 0.05); } }
.offcanvas-overlap .left-off-canvas-menu, .offcanvas-overlap .right-off-canvas-menu {
-ms-transform: none;
-webkit-transform: none;
-moz-transform: none;
-o-transform: none;
transform: none;
z-index: 1003; }
.offcanvas-overlap .exit-off-canvas {
-webkit-backface-visibility: hidden;
transition: background 300ms ease;
cursor: pointer;
box-shadow: -4px 0 4px rgba(0, 0, 0, 0.5), 4px 0 4px rgba(0, 0, 0, 0.5);
display: block;
position: absolute;
background: rgba(255, 255, 255, 0.2);
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: 1002;
-webkit-tap-highlight-color: transparent; }
@media only screen and (min-width: 40.063em) {
.offcanvas-overlap .exit-off-canvas:hover {
background: rgba(255, 255, 255, 0.05); } }
.offcanvas-overlap-left .right-off-canvas-menu {
-ms-transform: none;
-webkit-transform: none;
-moz-transform: none;
-o-transform: none;
transform: none;
z-index: 1003; }
.offcanvas-overlap-left .exit-off-canvas {
-webkit-backface-visibility: hidden;
transition: background 300ms ease;
cursor: pointer;
box-shadow: -4px 0 4px rgba(0, 0, 0, 0.5), 4px 0 4px rgba(0, 0, 0, 0.5);
display: block;
position: absolute;
background: rgba(255, 255, 255, 0.2);
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: 1002;
-webkit-tap-highlight-color: transparent; }
@media only screen and (min-width: 40.063em) {
.offcanvas-overlap-left .exit-off-canvas:hover {
background: rgba(255, 255, 255, 0.05); } }
.offcanvas-overlap-right .left-off-canvas-menu {
-ms-transform: none;
-webkit-transform: none;
-moz-transform: none;
-o-transform: none;
transform: none;
z-index: 1003; }
.offcanvas-overlap-right .exit-off-canvas {
-webkit-backface-visibility: hidden;
transition: background 300ms ease;
cursor: pointer;
box-shadow: -4px 0 4px rgba(0, 0, 0, 0.5), 4px 0 4px rgba(0, 0, 0, 0.5);
display: block;
position: absolute;
background: rgba(255, 255, 255, 0.2);
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: 1002;
-webkit-tap-highlight-color: transparent; }
@media only screen and (min-width: 40.063em) {
.offcanvas-overlap-right .exit-off-canvas:hover {
background: rgba(255, 255, 255, 0.05); } }
.no-csstransforms .left-off-canvas-menu {
left: -15.625rem; }
.no-csstransforms .right-off-canvas-menu {
right: -15.625rem; }
.no-csstransforms .move-left > .inner-wrap {
right: 15.625rem; }
.no-csstransforms .move-right > .inner-wrap {
left: 15.625rem; }
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Foundation | Welcome</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/5.5.0/css/foundation.min.css" />
</head>
<body><div class="off-canvas-wrap" data-offcanvas> <div class="inner-wrap"> <nav class="tab-bar"> <section class="left-small"> <a class="left-off-canvas-toggle menu-icon" href="#"><span></span></a> </section> <section class="middle tab-bar-section"> <h1 class="title">Foundation</h1> </section></a> </section> </nav>
<aside class="left-off-canvas-menu">
<ul class="off-canvas-list">
<li><label>Some Action</label></li>
<li class="main-menu"><a href="#">Main Menu</a></li>
<ul class="sub-menu">
<li><a href="#">Sub Menu</a></li>
<li><a href="#">Sub Menu</a></li>
<li><a href="#gohere">ID go here</a></li>
</ul>
<li class="main-menu"><a href="#">Main Menu</a></li>
<ul class="sub-menu">
<li><a href="#">Sub Menu</a></li>
<li><a href="#">Sub Menu</a></li>
<li><a href="#gohereagain">ID go here again</a></li>
</ul>
</ul>
</aside>
<section class="main-section">
<!-- content goes here -->
<div id="gohere">
<pre>
Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</pre>
</div>
<div id="gohereagain"> <pre>
Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</pre></div>
</section> <a class="exit-off-canvas"></a> </div> </div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/foundation/5.5.0/js/vendor/jquery.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/foundation/5.5.0/js/foundation.min.js"></script>
</body>
</html>
Upvotes: 2
Views: 1106
Reputation: 3175
Assuming an unstyled
off-canvas as shown in the doc, something like this should work.
Updated CSS
.move-right .exit-off-canvas {
box-shadow: none;
}
.move-left .exit-off-canvas {
box-shadow: none;
}
note make sure this is loaded after the foundation css is loaded.
As for the other issue with the sub-menu you have the following code in your example
<a href="#gohere">ID go here</a>
This tells the browser to do the following:
Link to an element with a specified id within the page (like href="#top")
But FireFox
has a known bug related to using IDs in hash anchors. There are a ton of techniques to get around this on the web, but I did not seen any that would be a decent solution to post on this site.
Upvotes: 0