We using this css
.event_box > a img{
width: 100%;
filter: brightness(70%);
display: block;
-webkit-transition: all 0.7s linear;
-moz-transition: all 0.7s linear;
-ms-transition: all 0.7s linear;
-o-transition: all 0.7s linear;
transition: all 0.7s linear;
}
.event_box >a:hover img:hover{
filter:brightness(100%)
}
.event_box .text-picture
{
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
color: #fff;
height: 0;
text-align: center;
font-family: Open Sans Semibold;
font-size: 26px;
font-weight: bold;
color: #fff;
text-transform: uppercase;
z-index: 999;
}
in combination with this html:
<div class="row">
<div class="event_box">
<a href="'.$templink.$langlink.$paginalink.'portfolio'.$caselink.'1000-wishes">
<img src="'.$url.'images/home/1000-wishes.jpg" alt="1000 Wishes"/>
<div class="text-picture">
1000 Wishes
</div>
</a>
</div>
</div>
You will see a picture with text on of the picture.
The mouse over effects works till your mousepointer hits the text, then the mouse over effect stops.
Is there a sollution for this problem?
.event_box > a img{
width: 100%;
filter: brightness(70%);
display: block;
-webkit-transition: all 0.7s linear;
-moz-transition: all 0.7s linear;
-ms-transition: all 0.7s linear;
-o-transition: all 0.7s linear;
transition: all 0.7s linear;
}
.event_box >a:hover img:hover{
filter:brightness(100%)
}
.event_box .text-picture
{
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
color: #fff;
height: 0;
text-align: center;
font-family: Open Sans Semibold;
font-size: 26px;
font-weight: bold;
color: #fff;
text-transform: uppercase;
z-index: 999;
}
<div class="row">
<div class="event_box">
<a href="http://www.jcsl.nl/clean/images/home/1000-wishes.jpg">
<img src="http://www.jcsl.nl/clean/images/home/1000-wishes.jpg" alt="1000 Wishes">
<div class="text-picture">
1000 Wishes
</div>
</a>
</div>
</div>
Sure. Add pointer-events: none; to the .text-picture CSS.
What this does is let mouse events (like hovering, clicking, etc) pass through the element. By doing this, the image's "hovered" state won't be interrupted, and thus it will stay bright.
.event_box > a img{
width: 100%;
filter: brightness(70%);
display: block;
-webkit-transition: all 0.7s linear;
-moz-transition: all 0.7s linear;
-ms-transition: all 0.7s linear;
-o-transition: all 0.7s linear;
transition: all 0.7s linear;
}
.event_box >a:hover img:hover{
filter:brightness(100%)
}
.event_box .text-picture
{
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
color: #fff;
height: 0;
text-align: center;
font-family: Open Sans Semibold;
font-size: 26px;
font-weight: bold;
color: #fff;
text-transform: uppercase;
z-index: 999;
pointer-events: none;
}
<div class="row">
<div class="event_box">
<a href="http://www.jcsl.nl/clean/images/home/1000-wishes.jpg">
<img src="http://www.jcsl.nl/clean/images/home/1000-wishes.jpg" alt="1000 Wishes">
<div class="text-picture">
1000 Wishes
</div>
</a>
</div>
</div>
Add pointer events none to the text-picture class
.event_box .text-picture
{
//this line
pointer-events:none;
----
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
color: #fff;
height: 0;
text-align: center;
font-family: Open Sans Semibold;
font-size: 26px;
font-weight: bold;
color: #fff;
text-transform: uppercase;
z-index: 0;
}
Related
I've just created a button. I've found a problem where my content doesn't fit on it's place.
Here is my code:
.btn-red {
display: inline-block;
padding: 13px 20px;
color: #fff;
text-decoration: none;
position: relative;
background: #f42f2c;
font: 10px "Oswald", sans-serif;
letter-spacing: 0.4em;
text-align: center;
text-indent: 2px;
text-transform: uppercase;
transition: color 0.1s linear 0.05s;
border-radius: 0;
border: 1px solid #f42f2c;
}
.btn-red:focus {
box-shadow:none !important;
}
.btn-red::before {
content: "READ MORE";
display: block;
position: absolute;
top: 50%;
left: 0;
width: 100%;
height: 1px;
background: #f9f9ff;
color:#f42f2c !important;
z-index: 1;
opacity: 0;
transition: height 0.2s ease, top 0.2s ease, opacity 0s linear 0.2s;
}
.btn-red::after {
transition: border 0.1s linear 0.05s;
}
.btn-red .btn-red-inner {
position: relative;
z-index: 2;
}
.btn-red:hover {
transition: color 0.1s linear 0s;
text-decoration: none;
color: #f42f2c !important;
}
.btn-red:hover::before {
top: 0;
height: 100%;
opacity: 1;
transition: height 0.2s ease, top 0.2s ease, opacity 0s linear 0s;
}
.btn-red:hover::after {
transition: border 0.1s linear 0s;
}
<a href="o-nas.php" class="btn-red">
<span class="btn-inner">READ MORE</span>
</a>
I tried to add padding: 13px 20px to .btn-red::before, but it has some bugs and I don't know how to solve this.
I think I achieve the same thing that you wanted without using :before to control the button text. Look below:
.btn-red {
position: relative;
display: inline-flex;
box-sizing: border-box;
padding: 13px 20px;
text-decoration: none;
background-color: #f42f2c;
border: 1px solid #f42f2c;
}
.btn-red:before {
position: absolute;
top: 50%;
left: 0;
width: 100%;
height: 0;
content: "";
background-color: #fff;
transform: translateY(-50%);
transition: height 0.2s ease-in-out;
}
.btn-red .btn-inner {
font: 10px "Oswald", sans-serif;
color: #fff;
line-height: 1em;
letter-spacing: 0.4em;
text-transform: uppercase;
z-index: 1;
transition: color 0.2s ease-in-out;
}
.btn-red:hover:before {
height: 100%;
}
.btn-red:hover .btn-inner {
color: #f42f2c;
}
<a class="btn-red" href="#" title="Read More">
<span class="btn-inner">Read more</span>
</a>
Hope this can help you anyway. If you have any doubt about the code, please, just let me know :)
Cheers!
Trying to make icons fade to .5 opacity and have link text fade in to 1.0 opacity at the same time. I can only get one to work. Trying to fix this without totally revamping the css and html if possible.
I'm trying to do this for the shop online store icons of this website:
http://mbc.milkstreetmarketing.com/.
.shoprow {
margin-bottom: 10px;
height: 100%;
width: 80%;
margin: 0 auto;
text-align: center;
padding-top: 2%;
padding-bottom: 4%;
}
.icons {
display: inline-block;
width: 11%;
padding: 0 10%;
position: relative;
}
.comingsoon {
position: absolute;
top: 40%;
left: 0;
right: 0;
font-size: 2vw;
color: #8ddc2b !important;
font-weight: bold !important;
opacity: 0;
transition: opacity .5s ease-in-out;
-moz-transition: opacity .5s ease-in-out;
-webkit-transition: opacity .5s ease-in-out;
}
.comingsoon:hover {
opacity: 1;
}
.shopnow {
position: absolute;
top: 40%;
left: 0;
right: 0;
font-size: 2vw;
color: red !important;
font-weight: bold !important;
opacity: 0;
transition: opacity .5s ease-in-out;
-moz-transition: opacity .5s ease-in-out;
-webkit-transition: opacity .5s ease-in-out;
}
.shopnow:hover {
opacity: 1;
}
.shoptitlesactive {
left: 0;
right: 0;
position: absolute;
color: #8ddc2b !important;
font-weight: bold;
}
.shoptitlesinactive {
left: 0;
right: 0;
position: absolute;
color: #bcbdc0 !important;
font-weight: bold;
}
<div id="shopwrapper">
<div id="shopoverlay">
<div id="shopstore">Shop Online Store</div>
<div class="shoprow">
<div class="icons">
<img src="http://mbc.milkstreetmarketing.com/wp-content/uploads/2015/06/Icon-2.png" class="imgicon"></img>
<p class="comingsoon">Coming Soon!</p>
<p class="shoptitlesinactive">ABRASIVES</p>
</div>
</div>
<div class="icons">
<img src="http://mbc.milkstreetmarketing.com/wp-content/uploads/2015/06/Icon-6.png">
<p class="shopnow">Shop Now!</p>
<p class="shoptitlesactive">DRILLING</p>
</div>
<div class="icons">
<img src="http://mbc.milkstreetmarketing.com/wp-content/uploads/2015/06/Icon-1.png">
<p class="comingsoon">Coming Soon!</p>
<p class="shoptitlesinactive">ELECTRICAL</p>
</div>
</div>
</div>
</div>
</div>
Have you tried something like this?
.icons:hover .shopnow, .icons:hover .comingsoon{
opacity: 1;
}
.icons:hover img{
opacity: .5;
}
Then you can remove these:
.shopnow:hover {
opacity: 1;
}
.comingsoon:hover {
opacity: 1;
}
I think you are looking for the + selector:
.imgicon:hover + .comingsoon, .comingsoon:hover {
opacity: 1;
}
.imgicon {
transition: opacity .5s ease-in-out;
}
.imgicon:hover {
opacity: 0.5;
}
When you hover .imgicon or .comingsoon, opacity: 1 is applied to .commingsoon. And when you hover .imgicon, opacity: 0.5 is applied to it.
.shoprow {
margin-bottom: 10px;
height: 100%;
width: 80%;
margin: 0 auto;
text-align: center;
padding-top: 2%;
padding-bottom: 4%;
}
.icons {
display: inline-block;
width: 11%;
padding: 0 10%;
position: relative;
}
.comingsoon {
position: absolute;
top: 40%;
left: 0;
right: 0;
font-size: 2vw;
color: #8ddc2b !important;
font-weight: bold !important;
opacity: 0;
transition: opacity .5s ease-in-out;
-moz-transition: opacity .5s ease-in-out;
-webkit-transition: opacity .5s ease-in-out;
}
.imgicon:hover + .comingsoon, .comingsoon:hover {
opacity: 1;
}
.imgicon {
transition: opacity .5s ease-in-out;
}
.imgicon:hover {
opacity: 0.5;
}
.shopnow {
position: absolute;
top: 40%;
left: 0;
right: 0;
font-size: 2vw;
color: red !important;
font-weight: bold !important;
opacity: 0;
transition: opacity .5s ease-in-out;
-moz-transition: opacity .5s ease-in-out;
-webkit-transition: opacity .5s ease-in-out;
}
.shopnow:hover {
opacity: 1;
}
.shoptitlesactive {
left: 0;
right: 0;
position: absolute;
color: #8ddc2b !important;
font-weight: bold;
}
.shoptitlesinactive {
left: 0;
right: 0;
position: absolute;
color: #bcbdc0 !important;
font-weight: bold;
}
<div id="shopwrapper">
<div id="shopoverlay">
<div id="shopstore">
Shop Online Store
</div>
<div class="shoprow">
<div class="icons">
<img src="http://mbc.milkstreetmarketing.com/wp-content/uploads/2015/06/Icon-2.png" class="imgicon"></img>
<p class="comingsoon">Coming Soon!</p>
<p class="shoptitlesinactive">ABRASIVES</p>
</div>
</div>
<div class="icons">
<img src="http://mbc.milkstreetmarketing.com/wp-content/uploads/2015/06/Icon-6.png">
<p class="shopnow">Shop Now!</p>
<p class="shoptitlesactive">DRILLING</p>
</div>
<div class="icons">
<img src="http://mbc.milkstreetmarketing.com/wp-content/uploads/2015/06/Icon-1.png">
<p class="comingsoon">Coming Soon!</p>
<p class="shoptitlesinactive">ELECTRICAL</p>
</div>
</div>
I've been working on a site and I've encountered a problem with transitions which only only happens in Chrome. Somehow Chrome doesn't want to do the transition which every other browser I use ( Safari, Firefox ) does.
Here's the HTML:
<div class="kategoria_box">
<div class="kategoria_box_header">
<h4>Fürdő</h4>
</div>
<div class="kategoria_box_image">
<a href="termekek/kategoriak/furdo/">
<img src="http://mondano.hu/img/furdo.jpg">
<span class="caption">
<p>Fürdőszoba</p>
</span>
</a>
</div>
</div>
and here's the CSS:
div.kategoria_box_image {
font-size: 1.5em;
font-weight: 200;
cursor: pointer;
float: left;
position: relative;
overflow: hidden;
}
div.kategoria_box_image img {
left: 0;
max-width: 460px;
-webkit-transition: all 600ms ease-out;
-moz-transition: all 600ms ease-out;
-o-transition: all 600ms ease-out;
-ms-transition: all 600ms ease-out;
transition: all 600ms ease-out;
}
div.kategoria_box_image .caption {
opacity: 0;
height: 100%;
text-align: left;
padding: 60px 0 0px 0px;
background-color: #fff;
position: absolute;
color: #5d5d5d;
z-index: 100;
-webkit-transition: all 600ms ease-out;
-moz-transition: all 600ms ease-out;
-o-transition: all 600ms ease-out;
-ms-transition: all 600ms ease-out;
transition: all 600ms ease-out;
left: 0;
}
div.kategoria_box_image:hover .caption {
opacity: 0.82;
}
Is something wrong about my code apart from being coded in my own unique style ?
You don't need the webkit- prefix anymore. You forgot to set top:0 for span.caption
http://caniuse.com/#feat=css-transitions
Here's my codepen:
http://codepen.io/dschu/pen/XbwYom
div.kategoria_box_image {
font-size: 1.5em;
font-weight: 200;
cursor: pointer;
float: left;
position: relative;
overflow: hidden;
}
div.kategoria_box_image img {
left: 0;
max-width: 460px;
transition: all 600ms ease-out;
}
div.kategoria_box_image .caption {
opacity: 0;
height: 100%;
text-align: left;
padding: 60px 0 0px 0px;
background-color: #fff;
position: absolute;
color: #5d5d5d;
z-index: 100;
transition: all 600ms ease-out;
top: 0;
left: 0;
}
div.kategoria_box_image:hover .caption {
opacity: 0.82;
}
I am trying to replicate (in my own way) the facebook change image on hover element.
But I am trying to make it fade out, which I can't seem to do... I wonder if anyone can help me.
Any help will be appreciated. Preferably I would want to do this without jQuery or JS.
So far I have this (on JSfiddle: http://jsfiddle.net/Blue_EyesWhiteDragon/p05e8n56):
HTML:
<span class="right">
<div class="ui-root">
<img class="profimg" id="profileimg" src="http://i.imgur.com/CabNLvV.jpg" width="130" height="130">
<a href="#" class="ui-link" role="button">
<div class="ui-popover">
<img class="ui-dimg" src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/yx/r/PuyR8Oy6W1C.png" alt="" width="32" height="32">
<div class="ui-text">Update Image</div>7
</div>
</a>
</div>
</span>
CSS:
.ui-root{
cursor: pointer;
height: 130px;
width: 130px;
}
.ui-root a:link, a:visited {
text-decoration: none;
}
.ui-link{
display: block;
text-align: center;
position: relative;
visibility: hidden;
top: -44px;
width: 130px;
height: 40px;
background-color: rgba(0, 0, 0, 68);
color: white;
opacity: 0;
-webkit-transition: padding 2s, //Contains Hover off | Chrome & Safari
-moz-transition: padding 2s; //Mozilla
-o-transition: padding 2s; //Opera
transition: padding 2s; //IE
}
.ui-img:hover + .ui-link{
zoom: 1;
opacity: 1;
visibility: visible;
background-color: rgba(0, 0, 0, 0.68);
border-radius: 1px;
-webkit-transition: border-radius 2s, background-color 300ms linear, opacity 300ms linear; //Contains Hover on | Chrome & Safari
-moz-transition: border-radius 2s, background-color 300ms linear, opacity 300ms linear; //Mozilla
-o-transition: border-radius 2s, background-color 300ms linear, opacity 300ms linear; //Opera
transition: border-radius 2s, background-color 300ms linear, opacity 300ms linear; //IE
}
.ui-link:hover{
zoom: 1;
opacity: 1;
visibility: visible;
background-color: rgba(0, 0, 0, 0.87);
border-radius: 1px;
-webkit-transition: padding 2s, background-color 300ms linear, opacity 300ms linear; //Contains Hover off | Chrome & Safari
-moz-transition: padding 2s, background-color 300ms linear, opacity 300ms linear; //Mozilla
-o-transition: padding 2s, background-color 300ms linear, opacity 300ms linear; //Opera
transition: padding 2s, background-color 300ms linear, opacity 300ms linear; //IE
}
.ui-dimg{
display: block;
text-align: left;
position: absolute;
top: 2px;
left: 2px;
}
.ui-text{
display: block;
text-align: left;
width: 108px;
padding-bottom: 10px;
padding-left: 40px;
padding-right: 12px;
padding-top: 10px;
top: 2px;
left: -2px;
position: absolute;
font-weight: 700;
font-size: 12px;
font-family: Helvetica, Arial, 'lucida grande',tahoma,verdana,arial,sans-serif;
word-wrap: break-word;
}
.ui-popover{
position: absolute;
z-index: 5;
left: 0px;
}
Are you trying to do something like this
.ui-root {
cursor: pointer;
height: 130px;
width: 130px;
}
.ui-root a:link,
a:visited {
text-decoration: none;
}
.ui-link {
display: block;
text-align: center;
position: relative;
top: -44px;
width: 130px;
height: 40px;
background-color: rgba(0, 0, 0, 68);
color: white;
opacity: 0;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
transition: all 1s ease;
}
.ui-img:hover + .ui-link {
zoom: 1;
opacity: 1;
background-color: rgba(0, 0, 0, 0.68);
border-radius: 1px;
}
.ui-link:hover {
zoom: 1;
opacity: 1;
visibility: visible;
background-color: rgba(0, 0, 0, 0.87);
border-radius: 1px;
}
.ui-dimg {
display: block;
text-align: left;
position: absolute;
top: 2px;
left: 2px;
}
.ui-text {
display: block;
text-align: left;
width: 108px;
padding-bottom: 10px;
padding-left: 40px;
padding-right: 12px;
padding-top: 10px;
top: 2px;
left: -2px;
position: absolute;
font-weight: 700;
font-size: 12px;
font-family: Helvetica, Arial, 'lucida grande', tahoma, verdana, arial, sans-serif;
word-wrap: break-word;
}
.ui-popover {
position: absolute;
z-index: 5;
left: 0px;
}
<span class="right">
<div class="ui-root">
<a href="#" class="ui-img">
<img class="profimg" id="profileimg" src="http://i.imgur.com/CabNLvV.jpg" width="130" height="130"></a>
<a href="#" class="ui-link" role="button">
<div class="ui-popover">
<img class="ui-dimg" src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/yx/r/PuyR8Oy6W1C.png" alt="" width="32" height="32" />
<div class="ui-text">Update Image</div>
</div>
</a>
</div>
</span>
I want to make a sliding menu using solely CSS. The menu will reveal a list of items and a close button inside it. I currently have an anchor tag on my homepage that is styled correctly, but it does not do anything when clicked.
HTML:
<body class="homepage body-push">
<!-- Menu -->
<nav class="menu" id="theMenu">
<div class="menu-wrap">
<h1 class="logo">Focus</h1>
<i class="icon-remove menu-close"></i>
Home
Services
Process
Portfolio
About
Contact
<i class="icon-facebook"></i>
<i class="icon-twitter"></i>
<i class="icon-dribbble"></i>
<i class="icon-envelope"></i>
</div>
<!-- Menu button -->
<div id="menuToggle"><i class="icon-reorder"></i></div>
</nav>
</body>
CSS:
.menu {
position: fixed;
right: -200px;
width: 260px;
height: 100%;
top: 0;
z-index: 10;
text-align: left;
}
.menu.menu-open {
right: 0px;
}
.menu-wrap {
position: absolute;
top: 0;
left: 60px;
background: #1a1a1a;
width: 200px;
height: 100%;
}
.menu a {
margin-left: 20px;
color: #808080;
display: block;
font-size: 12px;
font-weight: 700;
line-height: 40px;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.menu a:hover {
color: #ffffff;
}
.menu a:active {
color: #ffffff;
}
.menu a > i {
float: left;
display: inline-block;
vertical-align: middle;
text-align: left;
width: 25px;
font-size: 14px;
line-height: 40px;
margin: 25px 2px;
}
.menu-close {
cursor: pointer;
display: block;
position: absolute;
font-size: 14px;
color: #808080;
width: 40px;
height: 40px;
line-height: 40px;
top: 20px;
right: 5px;
-webkit-transition: all .1s ease-in-out;
-moz-transition: all .1s ease-in-out;
-ms-transition: all .1s ease-in-out;
-o-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
}
.menu-close:hover {
color: #ffffff;
-webkit-transition: all .1s ease-in-out;
-moz-transition: all .1s ease-in-out;
-ms-transition: all .1s ease-in-out;
-o-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
}
/* Push the body after clicking the menu button */
.body-push {
overflow-x: hidden;
position: relative;
left: 0;
}
.body-push-toright {
left: 200px;
}
.body-push-toleft {
left: -200px;
}
.menu,
.body-push {
-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
-ms-transition: all .3s ease;
-o-transition: all .3s ease;
transition: all .3s ease;
}
#menuToggle {
position: absolute;
top: 20px;
left: 0;
z-index: 11;
display: block;
text-align: center;
font-size: 14px;
color: #ffffff;
width: 40px;
height: 40px;
line-height: 40px;
cursor: pointer;
background: rgba(0,0,0,0.25);
-webkit-transition: all .1s ease-in-out;
-moz-transition: all .1s ease-in-out;
-ms-transition: all .1s ease-in-out;
-o-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
}
#menuToggle:hover {
color: #ffffff;
background: rgba(0,0,0,0.2);
-webkit-transition: all .1s ease-in-out;
-moz-transition: all .1s ease-in-out;
-ms-transition: all .1s ease-in-out;
-o-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
}
UPDATE: I finally found a way to get it working.
HTML:
<!-- Menu -->
<nav class="menu" id="theMenu">
<div class="menu-wrap">
<h1 class="logo">Menu</h1>
<i class="icon-remove menu-close"></i>
Home
Services
Process
Portfolio
About
Contact
<i class="icon-facebook"></i>
<i class="icon-twitter"></i>
<i class="icon-dribbble"></i>
<i class="icon-envelope"></i>
</div>
<!-- Menu button -->
<div id="menuToggle"><i class="icon-reorder"></i></div>
</nav>
CSS:
.menu {
position: fixed;
right: -200px;
width: 260px;
height: 100%;
top: 0;
z-index: 10;
text-align: left;
}
.menu.menu-open {
right: 0px;
}
.menu-wrap {
position: absolute;
top: 0;
left: 60px;
background: #1a1a1a;
width: 200px;
height: 100%;
}
.menu h1.logo a {
font-family: 'Raleway', Helvetica, Arial, sans-serif;
font-size: 16px;
font-weight: 800;
letter-spacing: 0.15em;
line-height: 40px;
text-transform: uppercase;
color: #ffffff;
margin-top: 20px;
}
.menu h1.logo a:hover {
color: #f85c37;
}
.menu img.logo {
margin: 20px 0;
max-width: 160px;
}
.menu a {
margin-left: 20px;
color: #808080;
display: block;
font-size: 12px;
font-weight: 700;
line-height: 40px;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.menu a:hover {
color: #ffffff;
}
.menu a:active {
color: #ffffff;
}
.menu a > i {
float: left;
display: inline-block;
vertical-align: middle;
text-align: left;
width: 25px;
font-size: 14px;
line-height: 40px;
margin: 25px 2px;
}
.menu-close {
cursor: pointer;
display: block;
position: absolute;
font-size: 14px;
color: #808080;
width: 40px;
height: 40px;
line-height: 40px;
top: 20px;
right: 5px;
-webkit-transition: all .1s ease-in-out;
-moz-transition: all .1s ease-in-out;
-ms-transition: all .1s ease-in-out;
-o-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
}
.menu-close:hover {
color: #ffffff;
-webkit-transition: all .1s ease-in-out;
-moz-transition: all .1s ease-in-out;
-ms-transition: all .1s ease-in-out;
-o-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
}
/* Push the body after clicking the menu button */
.body-push {
overflow-x: hidden;
position: relative;
left: 0;
}
.body-push-toright {
left: 200px;
}
.body-push-toleft {
left: -200px;
}
.menu,
.body-push {
-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
-ms-transition: all .3s ease;
-o-transition: all .3s ease;
transition: all .3s ease;
}
#menuToggle {
position: absolute;
top: 20px;
left: 0;
z-index: 11;
display: block;
text-align: center;
font-size: 14px;
color: #ffffff;
width: 40px;
height: 40px;
line-height: 40px;
cursor: pointer;
background: rgba(0,0,0,0.25);
-webkit-transition: all .1s ease-in-out;
-moz-transition: all .1s ease-in-out;
-ms-transition: all .1s ease-in-out;
-o-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
}
#menuToggle:hover {
color: #ffffff;
background: rgba(0,0,0,0.2);
-webkit-transition: all .1s ease-in-out;
-moz-transition: all .1s ease-in-out;
-ms-transition: all .1s ease-in-out;
-o-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
}
Javascript:
// Menu settings
$('#menuToggle, .menu-close').on('click', function(){
$('#menuToggle').toggleClass('active');
$('body').toggleClass('body-push-toleft');
$('#theMenu').toggleClass('menu-open');
});
// Scrollable menu on small devices
$(window).bind("load resize", function(){
if($(window).height() < 400){
$(".menu").css("overflow-y","scroll");
}
else {
$(".menu").css("overflow-y","hidden");
}
});
I would recommend reading this: http://www.sitepoint.com/css3-sliding-menu/
If the article is TL;DR then use
/* Revealing 3D Menu CSS */
body
{
font-family: sans-serif;
font-size: 100%;
padding: 0;
margin: 0;
color: #333;
background-color: #221;
}
/* main page */
article
{
position: fixed;
width: 70%;
left: 0;
top: 0;
right: 0;
bottom: 0;
padding: 30px 15%;
background-color: #fff;
overflow: auto;
z-index: 0;
-webkit-transform-origin: 0 50%;
-moz-transform-origin: 0 50%;
-ms-transform-origin: 0 50%;
-o-transform-origin: 0 50%;
transform-origin: 0 50%;
}
article:after
{
position: absolute;
content: ' ';
left: 100%;
top: 0;
right: 0;
bottom: 0;
background-image: -webkit-linear-gradient(right, rgba(0,0,0,0.2) 0%, transparent 100%);
background-image: -moz-linear-gradient(right, rgba(0,0,0,0.2) 0%, transparent 100%);
background-image: -ms-linear-gradient(right, rgba(0,0,0,0.2) 0%, transparent 100%);
background-image: -o-linear-gradient(right, rgba(0,0,0,0.2) 0%, transparent 100%);
background-image: linear-gradient(right, rgba(0,0,0,0.2) 0%, transparent 100%);
pointer-events: none;
}
/* navigation */
nav
{
position: fixed;
left: -16em;
top: 0;
bottom: 0;
background-color: #654;
border-right: 50px solid #765;
box-shadow: 4px 0 5px rgba(0,0,0,0.2);
z-index: 1;
cursor: pointer;
}
nav:after
{
position: absolute;
content: ' ';
width: 0;
height: 0;
right: -70px;
top: 50%;
border-width: 15px 10px;
border-style: solid;
border-color: transparent transparent transparent #765;
}
nav ul
{
width: 14em;
list-style-type: none;
margin: 0;
padding: 1em;
}
nav a:link, nav a:visited
{
display: block;
width: 100%;
font-weight: bold;
line-height: 2.5em;
text-indent: 10px;
text-decoration: none;
color: #ffc;
border-radius: 4px;
outline: 0 none;
}
nav a:hover, nav a:focus
{
color: #fff;
background-color: #543;
text-shadow: 0 0 4px #fff;
box-shadow: inset 0 2px 2px rgba(0,0,0,0.2);
}
/* hovering */
article, article:after, nav, nav *
{
-webkit-transition: all 600ms ease;
-moz-transition: all 600ms ease;
-ms-transition: all 600ms ease;
-o-transition: all 600ms ease;
transition: all 600ms ease;
}
nav:hover
{
left: 0;
}
nav:hover ~ article
{
-webkit-transform: translateX(16em) perspective(600px) rotateY(10deg);
-moz-transform: translateX(16em) perspective(600px) rotateY(10deg);
-ms-transform: translateX(16em) perspective(600px) rotateY(10deg);
-o-transform: translateX(16em) perspective(600px) rotateY(10deg);
transform: translateX(16em) perspective(600px) rotateY(10deg);
}
nav:hover ~ article:after
{
left: 60%;
}
This can be used to create a 3d sliding menu as seen here