I have three images acting as tabs. Each image has a semi-transparent overlay of orange. When you hover over it, the orange opacity will be darker. When you click on the image, the active state should look the same as the hover state.
So I did this:
.overlay:hover:after, .job-seekers-nav li.active {
opacity: .8!important;
transition: 1s ease;
}
But when I ran my code, I am able to do the hover effect but when I click on a certain image, it would load the right content, and once I hover off the image, the image will revert back to the original semi-orange color and not the darker hovered orange.
html
<div class="row main-container job-seekers-nav">
<!--job seekers tab-->
<ul>
<li>
<div class="col-sm-4">
<a data-toggle="tab" href="#light-industrial">
<div class="overlay border-bottom-yellow">
<img src="img/light-industrial.jpg" class="img-responsive center-images">
</div>
</a>
</div>
</li>
<li>
<div class="col-sm-4">
<a data-toggle="tab" href="#general-warehousing">
<div class="overlay border-bottom-yellow">
<img src="img/general-warehousing.jpg" class="img-responsive center-images">
</div>
</a>
</div>
</li>
<li>
<div class="col-sm-4">
<a data-toggle="tab" href="#administrative-work">
<div class="overlay border-bottom-yellow">
<img src="img/administrative-work.jpg" class="img-responsive center-images"/>
</div>
</a>
</div>
</li>
</ul>
<!--end of job seekers tab-->
</div>
css
.job-seekers-nav ul {
padding: 0;
}
.job-seekers-nav li {
display: inline;
list-style: none;
}
.overlay {
display:inline-block;
position: relative;
}
.overlay:after {
content:'';
top: 0;
left: 0;
z-index: 10;
width: 100%;
height: 100%;
display: block;
position: absolute;
background: #f4511e;
opacity: 0.5;
}
.overlay:hover:after, .job-seekers-nav li.active {
opacity: .8!important;
transition: 1s ease;
}
.border-bottom-yellow {
border-bottom: 30px solid #fce565;
}
Try this:
.overlay:hover:after,
.job-seekers-nav li.active .overlay:after
{
opacity: .8!important;
transition: 1s ease;
}
Related
When nav-toggle is checked sidebar reduces width and span is not displayed. When nav-toggle is unchecked it all comes back, but span displays the moment nav-toggle is unchecked and takes vertical space until sidebar is wide enough.
.sidebar {
width: 345px;
transition: width 300ms;
}
#nav-toggle:checked+.sidebar {
width: 70px;
}
#nav-toggle:checked+.sidebar li a span:last-child {
display: none;
}
<input type="checkbox" name="" id="nav-toggle">
<div class="sidebar">
<div class="sidebar-brand">
<h2><span class="lab la-accusoft"></span> <span>Acusoft</span></h2>
</div>
<div class="sidebar-menu">
<ul>
<li>
<a href="" class="active"><span class="las la-igloo"></span>
<span>Dashboard</span>
</a>
</li>
<li>
<a href=""><span class="las la-users"></span>
<span>Customers</span>
</a>
</li>
</ul>
</div>
</div>
I need to delay displaying 'span' until after transition is finished or sidebar is wide enough.
You could try changing the display: none into an opacity: 0, and have another transition with a transition-delay
This may not be an exact answer but could help you in the right direction. https://jsfiddle.net/treckstar/9uqgmnfk/16/
body {
font-size: 16px;
}
.app {
display: flex;
flex-flow: row nowrap;
max-width: 100%;
padding: 20px 0px 0px 0px;
position: relative;
}
#nav-toggle {
position: absolute;
top: 0px;
left: 0px;
}
.nav-toggle-label {
position: absolute;
top: 0px;
left: 20px;
}
.main-content {
flex: 1 0 auto;
height: 50vh;
background: #eee;
padding: .5rem 2rem;
}
.sidebar {
flex: 0 0 20%;
padding: .5rem 2rem;
height: 50vh;
transition: all 1s ease;
background-color: #ccc;
}
#nav-toggle:checked+.sidebar {
flex: 0 0 5%;
padding: .5rem .5rem;
}
.sidebar ul {
margin: 0px;
padding: 0px;
list-style: none;
}
.sidebar li a span {
opacity: 1;
transition: opacity .2s ease;
transition-delay: 1.25s;
}
#nav-toggle:checked+.sidebar li a span:last-child {
opacity: 0;
}
<div class="app">
<label class="nav-toggle-label" for="nav-toggle">Toggle</label>
<input type="checkbox" name="cb" id="nav-toggle">
<div class="sidebar">
<div class="sidebar-brand">
<h2><span class="lab la-accusoft"></span> <span>Acusoft</span></h2>
</div>
<div class="sidebar-menu">
<ul>
<li>
<a href="" class="active"><span class="las la-igloo"></span>
<span>Dashboard</span>
</a>
</li>
<li>
<a href=""><span class="las la-users"></span>
<span>Customers</span>
</a>
</li>
</ul>
</div>
</div>
<main class="main-content" role="main">
<h2>
Main Content
</h2>
</main>
</div>
I have created a drop down style menu using scss and bootstrap. I have been able to set everything up as required with one issue.
When hovering over the arrow on top of the drop down menu it highlights the arrow, I don't want this to happen. The arrow should only highlight when the first menu item is on hover.
How could I fix this? See codepen link :
https://codepen.io/duodice/pen/NJJXYJ
(images don't load that's fine as they're local files)
To replicate the problem :
1. Hover over "Services" on navbar
2. Hover over small triangle at the top of drop down menu
The scss :
$pop-up-menu-bg-clr : white;
$pop-up-menu-shade-clr : #B0c1d3;
$pop-up-menu-font-clr : #1b2b43;
.pop-up-menu-container {
position: relative;
li:hover {
.pop-up-menu-list {
display: block;
}
}
}
.pop-up-menu-list {
display: none;
position: absolute;
top: 100%;
left: 0;
width: 100%;
padding-top: 1.5rem;
background-color: transparent;
z-index: 999;
li a {
transition: none !important;
display: block;
color: $pop-up-menu-font-clr;
text-align: left;
background-color: $pop-up-menu-bg-clr;
width: 100%;
padding: 1rem;
&:hover {
background-color: $pop-up-menu-shade-clr;
color: white;
}
img {
height: 80%;
}
p {
color: $pop-up-menu-font-clr;
font-size: 13px;
margin-bottom: 0;
}
}
li:first-child {
position: relative;
z-index: 998;
&:hover {
border-bottom-color: y
}
a {
border-radius: 15px 15px 0 0;
}
&:before {
position: absolute;
content: "";
width: 0;
height: 0;
border: 1rem solid transparent;
border-bottom-color: $pop-up-menu-bg-clr;
top: 0;
left: 30%;
margin-top: calc(-2rem + 1px);
}
&:hover:before {
border-bottom-color: $pop-up-menu-shade-clr;
}
}
li:last-child a {
border-radius: 0 0 15px 15px;
}
}
Html :
<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" id="sidebarCollapse" data-toggle="collapse">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-end">
<ul class="navbar-nav pop-up-menu-container">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Services</a>
<ul class="pop-up-menu-list list-unstyled">
<li>
<a href="#">
<div class="row">
<div class="col-2 mr-2">
<img src="wwwroot/images/icons/settings.svg">
</div>
<div class="col">
All Services
<p>Learn more about our services</p>
</div>
</div>
</a>
</li>
<li>
<a href="#">
<div class="row">
<div class="col-2 mr-2">
<img src="wwwroot/images/icons/web_development_devices.svg">
</div>
<div class="col">
Web Development
<p>Design & Development</p>
</div>
</div>
</a>
</li>
<li>
<a href="#">
<div class="row">
<div class="col-2 mr-2">
<img src="wwwroot/images/icons/hosting_cloud.svg">
</div>
<div class="col">
Hosting & Maintenance
<p>Store your site online</p>
</div>
</div>
</a>
</li>
<li>
<a href="#">
<div class="row">
<div class="col-2 mr-2">
<img src="wwwroot/images/icons/marketing_growth.svg">
</div>
<div class="col">
Digital Marketing
<p>Get more visitors today</p>
</div>
</div>
</a>
</li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricing</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Disabled</a>
</li>
</ul>
</div>
</div>
</nav>
Thanks.
You set hover to li of first child without a (as you set to rest of li):
Change it to li a:hover:
See working code
li:first-child {
position: relative;
z-index: 998;
a:hover {
border-bottom-color: y
}
a {
border-radius: 15px 15px 0 0;
}
a:before {
position: absolute;
content: "";
width: 0;
height: 0;
border: 1rem solid transparent;
border-bottom-color: $pop-up-menu-bg-clr;
top: 0;
left: 30%;
margin-top: calc(-2rem + 1px);
}
a:hover:before {
border-bottom-color: $pop-up-menu-shade-clr;
}
}
I've made a JSFiddle to illustrate what I have at the moment. Please view my code here:
Some of my CSS snippet code:
.subnav {
display: none;
position: absolute;
//top: 58px;
background: #dfe6e8;
padding: 24px;
-webkit-transition: all .5s ease;
-moz-transition: all .5s ease;
transition: all .5s ease;
}
.subnav li {
margin-right: 0px !important;
min-width: 142px;
}
.subnav li a {
padding-bottom: 0px !important;
margin-bottom: 16px;
}
.subnav li:last-child a {
margin-bottom: 0px;
}
.has-dropdown:hover .subnav {
display: block;
}
I'm having problem to make my UL to stretch fullscreen. Here's what I'm trying to achieve as below:
Any help would be appreciated
To achieve this you have to make few structural and css changes. I edited your fiddle and made some changes to the navigation.
Html:
<div class="nav-container">
<nav class="top-bar">
<div class="container-fluid">
<div class="row nav-menu">
<div class="col-xs-12 columns">
<a class="navbar-brand" href="index.html"><img alt="Logo" class="logo logo-light" src="img/logo-light.png"> <img alt="Logo" class="logo logo-dark" src="http://www.subcablenews.com/links/images2/telenor.gif"></a>
<ul class="menu navbar-right">
<li>
ABOUT
</li>
<li class="has-dropdown">
PROGRAMMES
<ul class="subnav">
<li>
Programme 1
</li>
<li>
Programme 2
</li>
<li>
Programme 3
</li>
<li>
Programme 4
</li>
</ul>
</li>
<li class="has-dropdown">
PROJECTS
<div class="subnav subnav-halfwidth fullwidth">
<div class="col-sm-4">
<h6 class="alt-font">Project Lists</h6>
<ul class="subnav subnav-halfwidth">
<li>
Project 1
</li>
<li>
Project 2
</li>
<li>
Project 3
</li>
<li>
Project 4
</li>
</ul>
</div>
<div class="col-sm-4">
<h6 class="alt-font">Project Lists 2</h6><img alt="Logo" class="logo" src="http://www.subcablenews.com/links/images2/telenor.gif"></div>
<div class="col-sm-4">
<h6 class="alt-font">Project Lists 2</h6><img alt="Logo" class="logo" src="http://www.subcablenews.com/links/images2/telenor.gif"></div>
</div>
</li>
<li class="has-dropdown">
MEDIA
<ul class="subnav">
<li>
Media 1
</li>
<li>
Media 2
</li>
<li>
Media 3
</li>
<li>
Media 4
</li>
</ul>
</li>
<li>
CONTACT
</li>
</ul>
<ul class="social-icons text-right">
<li>
<i class="icon social_twitter"></i>
</li>
<li>
<i class="icon social_facebook"></i>
</li>
<li>
<i class="icon social_instagram"></i>
</li>
</ul>
</div>
</div><!--end of row-->
<div class="mobile-toggle">
<i class="icon icon_menu"></i>
</div>
</div><!--end of container-->
</nav>
</div>
Extra Css:
.subnav.fullwidth{
position: absolute;
right: -15px;
top: 58px;
width: 100vw;
background: #F6F4F4;
padding: 48px 64px 48px;
box-shadow: inset 0 1px 0 #e2e3df, 0 3px 6px rgba(113,111,111,.7);
-webkit-transform: translateX(0);
-moz-transform: translateX(0);
-ms-transform: translateX(0);
-o-transform: translateX(0);
transform: translateX(0);
-webkit-transition: opacity .3s 0s, visibility 0s 0s;
-moz-transition: opacity .3s 0s, visibility 0s 0s;
transition: opacity .3s 0s, visibility 0s 0s;
/* box-shadow: 1px 2px 5px #7D7D7D; */
}
.row{margin:0}
.top-bar .logo {
width: 150px;
}
.subnav li{float:none; display: block;}
Here is Updated Fiddle. Make sure you check the html as well. Because I made some changes in that too.
Read this to get better understand about bootstrap navigation. Hope this helps you.
It's because the parent elements aren't at 100% width. You can override this by using width:100vw; on any element that you want to take up the full width. Also, try and remember next time to only include css on your fiddle that's relevant to the html at question. It's a lot to sort through for someone trying to help when you include your entire stylesheet.
I have an UL menu, I want to animate a line underneath a LI when hovered, I'm trying to start with this:
.menu-container li:after {
content: "";
width: 0px;
height: 4px;
position: absolute;
bottom: 0;
left: 0;
display: block;
z-index: 2;
background: #fff;
-webkit-transition: width 0.3s;
transition: width 0.3s;
}
a:hover .menu-container li:after {
width: 100%;
}
<div class="menu-container">
<ul>
<a href="#">
<li>About</li>
</a>
<a href="#">
<li>Food & Farming</li>
</a>
<a href="#">
<li>Cookbook</li>
</a>
<a href="#">
<li>Schools</li>
</a>
<a href="#">
<li>Get Involved</li>
</a>
</ul>
</div>
It's not working though...
Any help on this would be awesome!!
Cheers
try this
.menu-container li:after {
content: "";
width: 0px;
height: 4px;
bottom: 0;
/* position: absolute; remove */
left: 0;
display: block;
z-index: 2;
background: #fff;
-webkit-transition: width 0.3s;
transition: width 0.3s;
width: 0%;
/* add */
background: red;
/* add */
}
.menu-container a:hover li:after {
/* change */
width: 100%;
}
<div class="menu-container">
<ul>
<a href="#">
<li>About</li>
</a>
<a href="#">
<li>Food & Farming</li>
</a>
<a href="#">
<li>Cookbook</li>
</a>
<a href="#">
<li>Schools</li>
</a>
<a href="#">
<li>Get Involved</li>
</a>
</ul>
</div>
Is this what you are looking for??
<html>
<head>
<style type="text/css">
.menu-container li:after {
content: "";
width: 0px;
height: 4px;
position: absolute;
bottom: 0;
left: 0;
display: block;
z-index: 2;
background: #fff;
-webkit-transition: width 0.3s;
transition: width 0.3s;
}
a:hover .menu-container li:after {
width: 100%;
}
.menu-container a {
text-decoration: none;
}
.menu-container a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div class="menu-container">
<ul>
<a href="#">
<li>About</li>
</a>
<a href="#">
<li>Food & Farming</li>
</a>
<a href="#">
<li>Cookbook</li>
</a>
<a href="#">
<li>Schools</li>
</a>
<a href="#">
<li>Get Involved</li>
</a>
</ul>
</div>
</body>
</html>
Try targeting it with .menu-container li:hover a:after {} or .menu-container li a:hover:after {}
I have two problems with my navigation in twitter bootstrap.
the links jump out of the navigation when I re-size the browser window
and 2. the collapsed navigation is hidden behind the carousel.
I want all my links in the navigation to have the same width, because they get a border in mouse-over but because of that they jump out of the navigation and are hidden behind the carousel/slider when re-sized.
They collapse just fine when re-sized to 768px but everything above that jumps out of navigation. And the other thing is that when the navigation is collapsed it is half hidden behind the carousel/slider when opened.
<nav class="navbar navbar-inverse" role="navigation">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="navbar-header">
<a class="navbar-brand" href="index.html">Test</a>
</div>
<div class="nav-collapse collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="span4">Home</li>
<li class="span4">Forschung</li>
<li class="span4">Fahrzeug</li>
<li class="span4">Team</li>
<li class="span4">Presse</li>
<li class="span4">Ziele</li>
<li class="span4">Karte</li>
<li class="span4">Jobs</li>
</ul>
</div>
</nav>
<div class="container">
<div id="this-carousel-id" class="carousel slide">
<ol class="carousel-indicators">
<li data-target="#this-carousel-id" data-slide-to="0" class="active"></li>
</ol>
<div class="carousel-inner">
<div class="item active">
<img src="http://placehold.it/1200x480" alt="" />
<div class="carousel-caption"><h1>Mercedes Benz</h1></div>
</div>
</div>
<a class="carousel-control left" href="#this-carousel-id" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a>
<a class="carousel-control right" href="#this-carousel-id" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span></a>
</div>
</div>
and this is the css
.navbar {
height: 100px;
font-family: 'Oswald', sans-serif;
text-transform: uppercase;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
padding-right: 5%;
background-color: #000000 !important;
box-sizing: border-box;
}
.navbar-inverse .navbar-nav > li > a { color: #a2a2a2 !important }
.nav a:link,
a:visited {
line-height: 4em;
display: block;
height: 100px;
width: 120px;
text-align: center;
text-decoration: none;
}
.nav a:after {
position: absolute;
top: 100%;
left: 0;
width: 100%;
height: 1px;
background: #062d67;
content: '';
opacity: 0;
-webkit-transition: height 0.3s, opacity 0.3s, -webkit-transform 0.3s;
-moz-transition: height 0.3s, opacity 0.3s, -moz-transform 0.3s;
transition: height 0.3s, opacity 0.3s, transform 0.3s;
-webkit-transform: translateY(-10px);
-moz-transform: translateY(-10px);
transform: translateY(-10px);
}
.nav a:hover,
a:focus,
a:active {
height: 81px;
color: #ffffff !important;
background-color: #0d0d0d !important;
}
.nav a:hover:after,
.nav a:focus:after,
.nav a:active:after {
height: 18px;
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
transform: translateY(0px);
}
Can anyone please point out what I did wrong?
You can't have 8 span4 elements in one row. the total sum of N in spanN must be 12 or below.
you can use span1in your case or no class on for <li> (list item) elements at all.