I'm trying to get a transitional animation on a DIV on hover. However, it's not working. I feel like I'm missing something!
JSFIDDLE DEMO
HTML
<div class="profile__container">
<img src="http://i.imgur.com/SGw04SV.jpg" class="profile__list--resume img-fluid" />
<div class="profile__button">
<h2>Hello World</h2>
</div>
</div>
CSS:
.profile__button {
display: none;
background: linear-gradient(to bottom, transparent 0%, #08ca77 60%);
padding: 120px 15px 15px;
text-transform: capitalize;
-moz-transition: all 0.5s ease-in-out;
transition: all 0.5s ease-in-out;
}
.profile__container:hover .profile__button {
display: block;
position: absolute;
left: 0;
right: 0;
bottom: 0;
width: 100%;
text-align: center;
}
Instead of using display property use opacity and visibility as shown below.
.profile__button {
background: linear-gradient(to bottom, transparent 0%, #08ca77 60%);
padding: 120px 15px 15px;
text-transform: capitalize;
transition: .5s;
opacity: 0;
visibility: hidden;
position: absolute;
left: 0;
right: 0;
bottom: 0;
width: 100%;
text-align: center;
}
.profile__container:hover .profile__button {
opacity: 1;
visibility: visible;
}
<div class="profile__container">
<img src="http://i.imgur.com/SGw04SV.jpg" class="profile__list--resume img-fluid" />
<div class="profile__button">
<h2>Hello World</h2>
</div>
</div>
.profile__container {
display: block;
height: 100%;
width: 100%;
}
div.profile__button, div.profile__button:hover {
display: inline-block;
padding: 70px 15px 15px;
text-transform: capitalize;
-moz-transition: .5s ease-in-out;
transition: .5s ease-in-out;
}
div.profile__button {
background: linear-gradient(to bottom, transparent 0%, #08ca77 30%);
opacity: 1;
}
div.profile__button:hover {
background: linear-gradient(to bottom, transparent 0%, #08ca77 90%);
opacity: 0.5;
}
We have some how managed to put out a css expandable navigation stuff... the problem what i am facing is you can see by mouse over on Home its expanding but you will also see that the last menu is blank... As well when you see the Portfolio mouse over you will see there are 3 menus only buy actually there are 5...
Ultimately what i want is what ever the total number of sub menus we provide may be 10 or 5 or 3 or even 2 the main menu should expand and show the same.
Can you please help with the issue...
HTML Code
<div class="nav">
<div class="menu-item alpha">
<h4>User Managment</h4>
<ul>
<li>View Users</li>
<li>Edit User</li>
</ul>
</div>
<div class="menu-item">
<h4>Portfolio</h4>
<ul>
<li>Web</li>
<li>Print</li>
<li>Other</li>
<li>Other</li>
<li>Other</li>
<li>Other</li>
</ul>
</div>
<div class="menu-item">
<h4>About</h4>
<ul>
<li>History</li>
<li>Meet The Owners</li>
<li>Awards</li>
</ul>
</div>
<div class="menu-item">
<h4>Contact</h4>
<ul>
<li>Phone</li>
<li>Email</li>
<li>Location</li>
</ul>
</div>
</div>
CSS Code As Follows
.nav * {
margin: 0px;
padding: 0px;
}
.nav {
font-family: Helvetica, Arial, "Lucida Grande", sans-serif;
font-size: 13px;
line-height: 1.5;
}
.menu-item {
background: #fff;
width: 200px;
}
/*Menu Header Styles*/
.menu-item h4 {
border-bottom: 1px solid rgba(0,0,0,0.3);
border-top: 1px solid rgba(255,255,255,0.2);
color: #fff;
font-size: 15px;
font-weight: 500;
padding: 7px 12px;
/*Gradient*/
background: #a90329; /* Old browsers */
background: -moz-linear-gradient(top, #a90329 0%, #8f0222 44%, #6d0019 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#a90329), color-stop(44%,#8f0222), color-stop(100%,#6d0019)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #a90329 0%,#8f0222 44%,#6d0019 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #a90329 0%,#8f0222 44%,#6d0019 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #a90329 0%,#8f0222 44%,#6d0019 100%); /* IE10+ */
background: linear-gradient(top, #a90329 0%,#8f0222 44%,#6d0019 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a90329', endColorstr='#6d0019',GradientType=0 ); /* IE6-9 */
}
.menu-item h4:hover {
background: #cc002c; /* Old browsers */
background: -moz-linear-gradient(top, #cc002c 0%, #6d0019 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#cc002c), color-stop(100%,#6d0019)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #cc002c 0%,#6d0019 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #cc002c 0%,#6d0019 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #cc002c 0%,#6d0019 100%); /* IE10+ */
background: linear-gradient(top, #cc002c 0%,#6d0019 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cc002c', endColorstr='#6d0019',GradientType=0 ); /* IE6-9 */
}
.menu-item h4 a {
color: white;
display: block;
text-decoration: none;
width: 200px;
}
/*ul Styles*/
.menu-item ul {
background: #fff;
font-size: 13px;
line-height: 30px;
height: 0px;
list-style-type: none;
overflow: hidden;
padding: 0px;
/*Animation*/
-webkit-transition: height 2s ease;
-moz-transition: height 1s ease;
-o-transition: height 1s ease;
-ms-transition: height 1s ease;
transition: height 1s ease;
}
.menu-item:hover ul {
height: 93px;
}
.menu-item ul a {
margin-left: 20px;
text-decoration: none;
color: #aaa;
display: block;
width: 200px;
}
/*li Styles*/
.menu-item li {
border-bottom: 1px solid #eee;
}
.menu-item li:hover {
background: #eee;
}
/*First Item Styles*/
.alpha p {
padding: 8px 12px;
color: #aaa;
}
.alpha p a {
color: #aaa;
font-style: italic;
}
.alpha p a:hover {
color: #ccc;
}
add the following and it should work as desired, basically you will need the height in pixels for the animation to continue to work so setting it to auto will disrupt the animation. Here in the code below I have considered a height of 31px per item in the menu
.menu-item:hover ul {
height: 93px;
}
.menu-item:nth-child(1):hover ul {
height: 63px;
}
.menu-item:nth-child(2):hover ul {
height: 155px;
}
Try to change .menu-item:hover ul class height to auto, you are limiting it to height as 93px. so remaining links were hidden
.menu-item:hover ul {
height: auto;
}
Updated demo:
CSS:
.menu-item ul {
max-height: 0px;
/*Animation*/
-webkit-transition: max-height 2s ease;
-moz-transition: max-height 1s ease;
-o-transition: max-height 1s ease;
-ms-transition: max-height 1s ease;
transition: max-height 1s ease;
}
.menu-item:hover ul {
max-height: 1000px;
}
Good evening, thanks for trying to help first off.
I have a 'portfolio' page with 45 images of houses I've built. They're laid out in a grid, 5 wide 9 down. Simply, when you click and expand the image in browser, it works great. However, when I view on mobile, it get's a little fishy. The image tends to stretch past the view of the screen.
My question is: how can I make the image stay in the viewport of say my mobile device instead of stretching passed the screen? I tried absolutely positioning the overlay, that didn't work.
The lightbox script i'm using: http://tympanus.net/Tutorials/CSS3Lightbox/index3.html
My portfolio page: http://www.ocalaplastering.com/portfolio.html
This would be my html heavily reduced. Multiply the "li" element times 45 and that's basically the page.
<body>
<div id="wrapper">
<div id="header"></div>
<div id="nav"></div>
<div content>
<ul class="lb-album">
<li>
<a href="#image-1">
<img src="images/work/thumbs/1.jpg" alt="image01">
<span>Expand</span>
</a>
<div class="lb-overlay" id="image-1">
<img src="images/work/full/1.jpg" alt="image01" />
<div>
Prev
Next
</div>
x Close
</div>
</li>
</ul>
</div>
</div>
</body>
As for the CSS, this is the styles for the aforementioned elements:
.lb-album{
width: 100%;
margin: 0 auto;
font-family: 'BebasNeueRegular', 'Arial Narrow', Arial, sans-serif;
}
.lb-album li{
float: left;
padding:0px;
padding-right:1px;
padding-bottom:1px;
position: relative;
list-style:none;
}
.lb-album li > a,
.lb-album li > a img{
display: block;
}
.lb-album li > a{
width: 150px;
height: 150px;
position: relative;
padding: 3px;
background: #816445;
-webkit-box-shadow: 1px 1px 2px #fff, 1px 1px 2px rgba(158,111,86,0.3) inset;
-moz-box-shadow: 1px 1px 2px #fff, 1px 1px 2px rgba(158,111,86,0.3) inset;
box-shadow: 1px 1px 2px #fff, 1px 1px 2px rgba(158,111,86,0.3) inset;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px 4px 4px 4px;
}
.lb-album li > a span{
position: absolute;
width: 150px;
height: 150px;
top: 3px;
left: 3px;
text-align: center;
line-height: 150px;
color: rgba(27,54,81,0.8);
text-shadow: 0px 1px 1px rgba(255,255,255,0.6);
font-size: 24px;
opacity: 0;
filter: alpha(opacity=0); /* internet explorer */
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"; /*IE8*/
background: rgb(241,210,194);
background: -moz-radial-gradient(center, ellipse cover, rgba(255,255,255,0.56) 0%, rgba(241,210,194,1) 100%);
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%,rgba(255,255,255,0.56)), color-stop(100%,rgba(241,210,194,1)));
background: -webkit-radial-gradient(center, ellipse cover, rgba(255,255,255,0.56) 0%,rgba(241,210,194,1) 100%);
background: -o-radial-gradient(center, ellipse cover, rgba(255,255,255,0.56) 0%,rgba(241,210,194,1) 100%);
background: -ms-radial-gradient(center, ellipse cover, rgba(255,255,255,0.56) 0%,rgba(241,210,194,1) 100%);
background: radial-gradient(center, ellipse cover, rgba(255,255,255,0.56) 0%,rgba(241,210,194,1) 100%);
-webkit-transition: opacity 0.3s linear;
-moz-transition: opacity 0.3s linear;
-o-transition: opacity 0.3s linear;
-ms-transition: opacity 0.3s linear;
transition: opacity 0.3s linear;
}
.lb-album li > a:hover span{
opacity: 1;
filter: alpha(opacity=99); /* internet explorer */
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=99)"; /*IE8*/
}
.lb-overlay{
width: 0px;
height: 0px;
position: fixed;
overflow: hidden;
left: 0px;
top: 0px;
padding: 0px;
z-index: 99;
text-align: center;
background: rgb(241,210,194);
background: -moz-radial-gradient(center, ellipse cover, rgba(255,255,255,0.56) 0%, rgba(241,210,194,1) 100%);
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%,rgba(255,255,255,0.56)), color-stop(100%,rgba(241,210,194,1)));
background: -webkit-radial-gradient(center, ellipse cover, rgba(255,255,255,0.56) 0%,rgba(241,210,194,1) 100%);
background: -o-radial-gradient(center, ellipse cover, rgba(255,255,255,0.56) 0%,rgba(241,210,194,1) 100%);
background: -ms-radial-gradient(center, ellipse cover, rgba(255,255,255,0.56) 0%,rgba(241,210,194,1) 100%);
background: radial-gradient(center, ellipse cover, rgba(255,255,255,0.56) 0%,rgba(241,210,194,1) 100%);
}
.lb-overlay > div{
position: relative;
color: rgba(27,54,81,0.8);
width: 550px;
height: 80px;
margin: 40px auto 0px auto;
text-shadow: 0px 1px 1px rgba(255,255,255,0.6);
}
.lb-overlay div p{
font-size: 14px;
text-align: left;
float: left;
width: 260px;
}
.lb-overlay a.lb-close{
background: rgba(27,54,81,0.8);
z-index: 1001;
color: #fff;
position: absolute;
top: 43px;
left: 50%;
font-size: 15px;
line-height: 26px;
text-align: center;
width: 50px;
height: 23px;
overflow: hidden;
margin-left: -25px;
opacity: 0;
filter: alpha(opacity=0); /* internet explorer */
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"; /*IE8*/
-webkit-box-shadow: 0px 1px 2px rgba(0,0,0,0.3);
-moz-box-shadow: 0px 1px 2px rgba(0,0,0,0.3);
box-shadow: 0px 1px 2px rgba(0,0,0,0.3);
}
.lb-overlay img{
/* height: 100%; For Opera max-height does not seem to work */
max-height: 100%;
position: relative;
opacity: 0;
filter: alpha(opacity=0); /* internet explorer */
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"; /*IE8*/
-webkit-box-shadow: 1px 1px 4px rgba(0,0,0,0.3);
-moz-box-shadow: 1px 1px 4px rgba(0,0,0,0.3);
box-shadow: 0px 2px 7px rgba(0,0,0,0.2);
-webkit-transition: opacity 0.5s linear;
-moz-transition: opacity 0.5s linear;
-o-transition: opacity 0.5s linear;
-ms-transition: opacity 0.5s linear;
transition: opacity 0.5s linear;
}
.lb-prev, .lb-next{
text-indent: -9000px;
position: absolute;
top: -32px;
width: 24px;
height: 25px;
left: 50%;
opacity: 0.8;
filter: alpha(opacity=80); /* internet explorer */
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=80)"; /*IE8*/
}
.lb-prev:hover, .lb-next:hover{
opacity: 1;
filter: alpha(opacity=99); /* internet explorer */
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=99)"; /*IE8*/
}
.lb-prev{
margin-left: -30px;
background: transparent url(../images/arrows.png) no-repeat top left;
}
.lb-next{
margin-left: 6px;
background: transparent url(../images/arrows.png) no-repeat top right;
}
.lb-overlay:target {
width: auto;
height: auto;
bottom: 0px;
right: 0px;
padding: 80px 100px 120px 100px;
}
.lb-overlay:target img,
.lb-overlay:target a.lb-close{
opacity: 1;
filter: alpha(opacity=99); /* internet explorer */
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=99)"; /*IE8*/
}
/*
100% Height for Opera as the max-height seems to be ignored, not optimal for large screens
http://bricss.net/post/11230266445/css-hack-to-target-opera
*/
x:-o-prefocus, .lb-overlay img {
height: 100%;
}
There isn't jQuery involved, so i'm assuming it will just be a very simple property to add, but I cannot figure it out.
Cheers for the help!
This can be solved with a simple addition to your CSS on line 355 (.lb-overlay img):
Add a max-width: 100%; below the max-height:100%;
Let me know if that makes it behave how you are expecting!
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.