Please see: https://codepen.io/alanvkarlik/pen/BYzYoY
<div class="hover_img">
<a class="hover_link" href="x">
Title
<span>
<img src="image.jpg" width="100%"/>
</span>
</a>
</div>
and css:
.hover_img span {
z-index:-1;
opacity: 0;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-webkit-transition: opacity 300ms ease-in-out;
transition: opacity 400ms ease-in-out;
}
.hover_img a:hover span {
display: inline-block;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
opacity: 1;
}
basically if you go to my site, and hover below last link "Do Graphic Designers Need To Be Human?" the image will still show up because it's "hidden" underneath, moving mouse even lower triggers another image/link
I'm not sure if I can simplify the code somehow to make it work? All I want is for the image to show up when the mouse is hovering the link ONLY, not the area around it
Adding just display: none to .hover_img span should helps a bit:
.hover_img span {
display: none;
z-index:-1;
opacity: 0;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-webkit-transition: opacity 300ms ease-in-out;
transition: opacity 400ms ease-in-out;
}
I tried your code, I was able to do it but animation is gone now. Hopefully you will be able to resolve it.
/* PROJECTS LINKS + BACKGROUND */
.hover_link > span { display: none; }
}
.hover_link {
transition: 0.3s;
text-decoration: none;
padding: 0 3px;
background-color: #5544ee;
color: #000;
padding: 0px 3px;
text-decoration: none;
background: -moz-linear-gradient(top, rgba(255,255,255,0) 0%,rgba(85,68,238,0) 20%,rgba(85,68,238,1) 21%,rgba(85,68,238,1) 73%,rgba(85,68,238,0) 74%,rgba(255,255,255,0) 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(top, rgba(255,255,255,0) 0%,rgba(85,68,238,0) 20%,rgba(85,68,238,1) 21%,rgba(85,68,238,1) 72%,rgba(85,68,238,0) 72%,rgba(255,255,255,0) 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, rgba(255,255,255,0) 0%,rgba(85,68,238,0) 20%,rgba(85,68,238,1) 21%,rgba(85,68,238,1) 73%,rgba(85,68,238,0) 74%,rgba(255,255,255,0) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00ffffff', endColorstr='#00ffffff',GradientType=0 ); /* IE6-9 */
}
Related
I'm actual trying to use some button-hover effects like this one here: http://codepen.io/davidicus/pen/emgQKJ
Now I stuck because the button hover effect doesn't work when I use background-coloron my div #menu.
Can someone explain to me what I'm doing wrong here?
<div id="wrapper">
<div id="header">
</div>
<div id="gradient">
</div>
<div id="menu">
<span>Startseite</span>
</div>
<div id="gradient2">
</div>
<div id="content">
<div id="innerContent">
</div>
</div>
<div id="footer">
<div id="copyright"></div>
<div>
</div>
MyCSS:
html, body
{
box-sizing: border-box;
height: 100%;
width: 100%;
}
body
{
background-color: #61DC00;
font-family: 'Roboto', sans-serif;
font-weight: 400;
}
#wrapper
{
width:960px;
min-height:500px;
margin: 0 auto;
border: 1px solid black;
}
#menu {
width:960px;
height:30px;
padding-bottom:2px;
/* background-color: #fff; */
}
.btn-4 {
border: 1px solid;
overflow: hidden;
position: relative;
}
.btn-4 span {
z-index: 20;
}
.btn-4:after {
background: #F50606;
content: "";
height: 155px;
left: -75px;
position: absolute;
top: -50px;
-webkit-transform: rotate(35deg);
-ms-transform: rotate(35deg);
transform: rotate(35deg);
-webkit-transition: all 550ms cubic-bezier(0.19, 1, 0.22, 1);
transition: all 550ms cubic-bezier(0.19, 1, 0.22, 1);
width: 50px;
z-index: -10;
}
.btn-4:hover:after {
left: 120%;
-webkit-transition: all 550ms cubic-bezier(0.19, 1, 0.22, 1);
transition: all 550ms cubic-bezier(0.19, 1, 0.22, 1);
}
#menu div , a{
width:120px;
height:27px;
color:#000000;
float:left;
font-weight:none;
text-decoration:none;
text-align:center;
padding-top:4px;
font-family:verdana,arial;
font-size:16;
}
#content {
width:960px;
height:660px;
background-color:#fff;
margin:auto;
padding-top:20px;
}
#header
{
width:960px;
height:122px;
background-color: #fff;
margin: 0 auto;
}
#gradient {
height:10px;
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#fcfff4+0,dfe5d7+40,acb1ac+100 */
background: rgb(252,255,244); /* Old browsers */
background: -moz-linear-gradient(top, rgba(252,255,244,1) 0%, rgba(223,229,215,1) 40%, rgba(172,177,172,1) 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(top, rgba(252,255,244,1) 0%,rgba(223,229,215,1) 40%,rgba(172,177,172,1) 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, rgba(252,255,244,1) 0%,rgba(223,229,215,1) 40%,rgba(172,177,172,1) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfff4', endColorstr='#acb1ac',GradientType=0 ); /* IE6-9 */
}
#gradient2 {
height:10px;
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#acb1ac+0,dfe5d7+100,fcfff4+100 */
background: rgb(172,177,172); /* Old browsers */
background: -moz-linear-gradient(top, rgba(172,177,172,1) 0%, rgba(223,229,215,1) 100%, rgba(252,255,244,1) 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(top, rgba(172,177,172,1) 0%,rgba(223,229,215,1) 100%,rgba(252,255,244,1) 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, rgba(172,177,172,1) 0%,rgba(223,229,215,1) 100%,rgba(252,255,244,1) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#acb1ac', endColorstr='#fcfff4',GradientType=0 ); /* IE6-9 */
}
JSFIDDLE: https://jsfiddle.net/qm2cae9r/1/
You have .btn-4:after selector with
z-index: -10;
Remove it and nice effect will work again
On hover I want to fade in a gradient. I works fine, but on mouse leave there is no transition back. What is wrong, how can I improve the code?
jsfiddle
HTML
<header class="parent">
Hover here!
<div class="child"></div>
</header>
CSS
.child {
height: 100px;
position: absolute;
left: 0;
top: 0;
width: 100%;
z-index: -1;
opacity: 0;
-webkit-transition: all 1s ease-out;
-moz-transition: all 1s ease-out;
-o-transition: all 1s ease-out;
/* Opera */
transition: all 1s ease-out;
/* Standard */ }
.parent {
height: 120px;
position: absolute;
left: 0;
top: 0;
width: 100%;
z-index: 100;
opacity: 1 !important; }
.parent:hover .child {
opacity: 1;
background: -moz-linear-gradient(top, #ededed 0%, #ededed 30%, rgba(237, 237, 237, 0) 99%);
/* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ededed), color- stop(30%, #ededed), color-stop(99%, rgba(237, 237, 237, 0)));
Simply move your background out of the :hover state, onto the .child directly- seeing as you are only animating the opacity of .child this is all that is required. The reason it isnt working at present is also due to the fact you are only listing a single background state, that for hover- when you arent hovering the parent, the background is immediately removed (as no default is present) although the opacity is transitioning- so you see the 'jump'
Demo Fiddle
You have added the bg-gradient to child on hovering only.
Move the background css property to child{ /* background property */ } at default state(mouse leave)
It works good here http://jsfiddle.net/nvishnu/4paLf352/16/
I am trying to get my template working and I have a test page so you can see the miss-hap.
http://merkd.com/gtamoney
The header disappears in the top right corner of the page, but the header border at the bottom of the header seems unaffected and runs the whole length of the page. My CSS is below; I placed the #header and #headerBorder at the top but I also included the rest of the CSS for all the objects in the header just in case it's relevant.
#headerBorder {
display: block;
position: fixed;
z-index: 99;
top: 3.0em;
width: 100%;
height: 0.5em;
background: #ffffff; /* Old browsers */
background: -moz-linear-gradient(top, #ffffff 0%, #cccccc 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#cccccc)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 0%,#cccccc 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%,#cccccc 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%,#cccccc 100%); /* IE10+ */
background: linear-gradient(to bottom, #ffffff 0%,#cccccc 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#cccccc',GradientType=0 ); /* IE6-9 */
}
#header {
position: fixed;
width: 100%;
top: 0;
z-index: 100;
left: 0;
background-color: #FFFFFF;
height: 3.0em;
}
#header #logo {
position: fixed;
left: 3.0em;
top: 0.4em;
width: 7.25em;
height: 3.0em;
}
#header a {
display: block;
float: right;
height: 2.25em;
font-size: 0.9em;
text-decoration: none;
font-weight: 600;
color: #777777;
text-transform: uppercase;
letter-spacing: 0.01em;
margin: 0.15em 0 0 2.5em;
padding: 1.25em 0.5em 0.2em 0.5em;
transition: color 0.30s ease-in-out;
-o-transition: color 0.30s ease-in-out;
-moz-transition: color 0.30s ease-in-out;
-webkit-transition: color 0.30s ease-in-out;
} #header a:last-of-type { margin-left: 0; }
#header a:hover {
color: #000000;
}
#header div {
float: right;
margin: -0.1em 2.0em 0 0;
}
#header div a {
margin: 0;
}
#header div a img {
width: 1.5em;
height: 1.5em;
opacity: 0.6;
margin: 0;
}
#header div a:hover img {
opacity: 1.0;
transition: opacity 0.30s ease;
-o-transition: opacity 0.30s ease;
-moz-transition: opacity 0.30s ease;
-webkit-transition: opacity 0.30s ease;
}
Remove
#header { right: 10em; }
from alpha.header.css
CSS should looks like below
body {
background-color: #AAAAAA;
background-image: url("/engine/img/texture.png");
background-repeat: repeat;
margin: 0; }
#header {
background-color: #FFFFFF;
height: 3em;
min-width: 100%;
right: 10em;
top: 0;
z-index: 100; }
#headerBorder {
background: linear-gradient(to bottom, #FFFFFF 0%, #CCCCCC 100%) repeat scroll 0 0 rgba(0, 0, 0, 0);
display: block;
height: 0.5em;
top: 3em;
width: 100%;
z-index: 99; }
Note: Try not to use position:fixed.
Hi guys I have a pretty simple one:
How can I make before and after CSS properties (mainly used to make a DIV shape) disappear after a transition. I am working on a project for class and can't seem to figure it out.
The page is supposed to look like this:
http://ista230.com/images/assignments/7/page2.jpg
Heres what i have for CSS:
/* Navigation */
#nav{
margin-bottom:2%;
margin-top:0%;
width:100%;
background: #1d6287;
}
#nav ul {
padding: 100px 0 0; /* Remove default but add 40px to top */
margin: 0; /* Remove default */
list-style: none;
width: 100%;
overflow: hidden; /* So it 'contains' the floated <li> elements */
}
#nav ul li {
text-align:center;
float: left;
min-height: 50px;
width: 20%; /* 6 items means 20% each */
position: relative;
}
#nav a {
text-decoration:none;
color:black;
display: block;
width: 100%; /* 100% of <li> */
position: absolute;
bottom: 0;
left: 0;
}
div.navItem {
padding: 4% 4%;
position: relative;
background: #D54D25;
border: 2px solid #D54D25;
}
/* For little dumb triangle */
div.navItem:after, div.navItem:before {
bottom: 100%;
border: solid transparent;
content: " ";
height: 1px;
width: 1px;
position: absolute;
pointer-events: none;
}
div.navItem:after {
border-color: rgba(136, 183, 213, 0);
border-bottom-color: #D54D25;
border-width: 10px;
left: 50%;
margin-left: -30px;
}
div.navItem:before {
border-color: rgba(213, 77, 37, 0);
border-bottom-color: #D54D25;
border-width: 26px;
left: 40%;
margin-left: -26px;
}
div.navItem{
-moz-transition: height .5s ease; /* Firefox 4 */
-webkit-transition: height .5s ease; /* Safari and Chrome */
-o-transition: height .5s ease; /* Opera */
-ms-transition: height .5s ease; /* IE9 (maybe) */
transition:height .5s ease;
}
.navItem:hover
{
background: #999; /* Old browsers */
color:white;
border:none;
background: #999;
background-image: url("../images/logo.png") no-repeat center; /* fallback */
background: url("../images/logo.png") no-repeat center, -webkit-gradient(linear, left top, left bottom, from(#6cab26), to(#6ceb86)); /* Saf4+, Chrome */
background: url("../images/logo.png")no-repeat center, -webkit-linear-gradient(top, #999, #FEFEFE); /* Chrome 10+, Saf5.1+ */
background: url("../images/logo.png")no-repeat center, -moz-linear-gradient(top, #999, #FEFEFE); /* FF3.6+ */
background: url("../images/logo.png")no-repeat center, -ms-linear-gradient(top, #999, #FEFEFE); /* IE10 */
background: url("../images/logo.png")no-repeat center, -o-linear-gradient(top, #999, #FEFEFE); /* Opera 11.10+ */
background: url("../images/logo.png")no-repeat center, linear-gradient(top, #999, #FEFEFE); /* W3C */
height: 130px;
}
And the HTML:
<nav id="nav">
<ul>
<li><div class="navItem">Home</div></li>
<li><div class="navItem">Upcoming Flights</div></li>
<li><div class="navItem">About Us</div></li>
<li><div class="navItem">Travel Guide</div></li>
<li><div class="navItem">Contact Us!</div></li>
</ul>
</nav>
if you want to disappear up arrow, after hovering menu item you can use this selector:
div.navItem:hover:before{
opacity:0;
}
this selector works for your code. I made some change in your code you can see it here: jsFiddle
You can use jQuery to listen to transition end
jQuery(".navItem").one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(e) {
your function here;
});
See demo here http://jsfiddle.net/Godinall/Aq2SB/
My navagation menu will work in IE8 but works in IE7,9,10. It appears that the #nav_wrap is hiding the the sub menu on hover (if I expand the height of the #nav_wrap i can see the sub menu on hover but only the amount added by the parent container height). I am lost at this point and have no idea how to resolve it since it works in all other IEs, Chrome, Safari and Moz. Any please have an idea???
HTML
<div id="nav_wrap">
<div id="nav">
<?php wp_nav_menu( array( 'theme_location' => 'header-menu',) ); ?>
</div>
</div>
CSS
#nav_wrap {
height: 38px;
width: 100%;
margin: -20px auto;
position: absolute;
left: 0;
z-index: 400;
}
/*-- Nav --*/
#nav {
width: 648px;
height: 98%;
z-index: 10;
margin: 0px auto;
font-family: 'Marcellus SC', serif;
font-size: 16px;
letter-spacing: 1px;
font-style:italic;
z-index: 400;
background: #dc0000; /* Old browsers */
background: -moz-linear-gradient(top, #dc0000 0%, #650101 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#dc0000), color-stop(100%,#650101)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #dc0000 0%,#650101 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #dc0000 0%,#650101 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #dc0000 0%,#650101 100%); /* IE10+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#dc0000', endColorstr='#650101',GradientType=0 ); /* IE6-9 */
background: linear-gradient(top, #dc0000 0%,#650101 100%); /* W3C */
}
#nav ul,
#nav li,
div.menu ul,
div.menu ul li,
ul.menu, ul.menu li {
list-style: none;
padding: 0;
margin: 0;
display: inline;
}
#nav ul li {
float: left;
position: relative;
}
#nav ul li a {
display: block;
padding: 8px 12px;
margin: 1px;
font-size: 15px;
white-space: nowrap;
border-radius: 24px;
color: white;
-webkit-transition: color .3s ease-in-out;
-moz-transition: color .3s ease-in-out;
-o-transition: color .3s ease-in-out;
}
#nav ul li a:hover { color: #081b3d; }
#nav ul ul {
position: absolute;
top: -99999px;
left: 0;
opacity: 0; /* Hide sub level */
-webkit-transition: opacity .5s ease-in-out;
-moz-transition: opacity .5s ease-in-out;
-o-transition: opacity .5s ease-in-out;
z-index: 1497;
background: #dc0000;
padding: 2px;
border: 1px solid #dc0000;
border-top: none;
box-shadow: #111 0 3px 14px;
border-bottom-left-radius: 6px;
border-bottom-right-radius: 6px;
}
#nav ul ul ul {
position: absolute;
top: -99999px;
left: 100%;
opacity: 0;
-webkit-transition: opacity .5s ease-in-out; /* Hide sub levels */
-moz-transition: opacity .5s ease-in-out;
-o-transition: opacity .5s ease-in-out;
border-radius: 6px;
border: 1px solid #dc0000;
}
#nav ul li:hover > ul {
opacity: 1;
position: absolute;
top: 99%;
left: 0;
z-index: 497;
}
#nav ul ul li:hover > ul {
position: absolute;
top: 0;
left: 100%;
opacity: 1;
z-index: 497;
background: #081b3d;
}
the site
For those who ever had this it was fixed by removing
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#dc0000', endColorstr='#650101',GradientType=0 ) !important; /* IE6-9 */
from all the nav containers. Not sure why.