How to change menu image when hovering over different links? - html

Let me start of by saying that I am new to this. I have some code from a template that I am using. On the menu drop down there is a list of the links to other pages and next to it is an image. What would I need to add to make the image change to another image when you hover over each of the links?
Here is the code.
<li class="menu-item-has-children megamenu">
<a href="#">
<span class="link-icon"></span>
<span class="link-txt">
<span class="link-ext"></span>
<span class="txt">
Equipment
<span class="submenu-expander">
<i class="fa fa-angle-down"></i>
</span>
</span>
</span>
</a>
<ul class="nav-item-children">
<li>
<div class="container megamenu-container">
<div class="vc_row row megamenu-inner-row bg-white p-0">
<div class="container ld-container">
<div class="row ld-row">
<div class="megamenu-column col-md-3 py-md-3 px-md-4">
<div class="megamenu-column-inner pl-md-4 py-md-4">
<ul class="lqd-custom-menu reset-ul font-size-15 lh-2 ltr-sp-025 font-weight-medium">
<li>
<i class="fa fa-angle-right mr-2"></i>Vertical Cartoners
</li>
<li>
<i class="fa fa-angle-right mr-2"></i>Horizontal Cartoners
</li>
<li>
<i class="fa fa-angle-right mr-2"></i>Pre Made Pouch Machines
</li>
<li>
<i class="fa fa-angle-right mr-2"></i>Case Packers
</li>
<li>
<i class="fa fa-angle-right mr-2"></i>Rigid Container Fillers
</li>
<li>
<i class="fa fa-angle-right mr-2"></i>Carton Sleeve Wrappers
</li>
</ul>
</div><!-- /.megamenu-column-inner -->
</div><!-- /.megamenu-column -->
<div class="megamenu-column col-md-3 bg-cover bg-center" data-responsive-bg="true">
<img class="invisible" src="./img/equipment/vertical-cartoner.jpg" alt="Megamenu Image">
</div><!-- /.megamenu-column -->
</div><!-- /.row ld-row -->
</div><!-- /.container ld-container -->
</div><!-- /.vc_row -->
</div><!-- /.megamenu-container -->
</li>
</ul>
</li>

I would use scripting for this kind of thing
$(document).ready(function(){
$('#op1').hover(function(){
$('#image').css('background-image','url("https://via.placeholder.com/150.png?text=op1")')
});
$('#op2').hover(function(){
$('#image').css('background-image','url("https://via.placeholder.com/150.png?text=op2")')
});
$('#op3').hover(function(){
$('#image').css('background-image','url("https://via.placeholder.com/150.png?text=op3")')
});
});
#image{
background-image: url("https://via.placeholder.com/150");
border: 1px solid black;
width: 150px;
height: 150px;
}
#op1, #op2, #op3{
padding: 5px;
cursor: pointer;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="image"></div>
<div id="op1">hover for op1</div>
<div id="op2">hover for op2</div>
<div id="op3">hover for op3</div>

Find this in your css stylesheet
.megamenu .link-icon {
...
}
Add the next lines right after it for a mouse-over effect. Sorry for the dots. For reason that your current css is unknown it is not possible to give the full solution.
.megamenu > a:hover .link-icon {
...
}

Related

Icons will not align with the text element

I'm creating an account page (header) for the first time, and I notice that some of the icons will not align perfectly with the text. I know how simple and easy this is for advanced developers, but I'm just starting off and really need some advice.
I have tried using padding and margin as a style element but didn't work.
<header>
<div class="container">
<div class="row">
<div class="col-xs-6 col-md-8">
<div class="row">
<div class="col-sm-3">
<img src="paylocity_logo.png" alt="logo" style="width:100%"S/></a>
</div>
<div class="col-sm-9 hidden-sm hidden-xs" id="project-details">
<a class="home-link" href="" title="Edit"> <i class="material-icons"> home </i> </a>
<div class="project">
User Profile
</div>
</div>
</div>
</div>
<div class="col-xs-6 col-md-4 text-right" id="account">
<i class="material-icons">account_circle</i> <span>Tom Markart </span>
<div id="account-options">
<ul>
<li>
<span> <i class="material-icons">account_circle</i></span>View Profile
</li>
<li>
<span class="fa fa-cog"></span>Settings
</li>
<li>
<span class="fa fa-bug"></span>Report a Bug
</li>
<li>
<span class="fa fa-power-off"></span>Log Out
</li>
</ul>
</div>
</div>
</div>
</header>
I want to make them straight.
In your case, you can add the following rule:
.material-icons {
vertical-align: middle;
}
https://codepen.io/anon/pen/EBBbpd
Using flex:
Wrap text in <span> and a wrapper class to <a>.
...
<li>
<a class='wrapper' href="javascript:void(0);">
<span class="fa fa-cog"></span>
<span>Settings</span>
</a>
</li>
...
.wrapper {
display: flex;
align-items: center
}

Adding margin-right % put last item in next row

I've a set of links of my footer. I want to put some extra spacing between each other, but now last item goes to the next line.
I think is important to note that I'm using Bootstrap 4, and that the Left Col is set to col-md-8 so there is enough space for the links.
Codepen
https://codepen.io/anon/pen/GaaJRm
Demo
ul>li {
display: inline-block;
/* You can also add some margins here to make it look prettier */
zoom: 1;
*display: inline;
/* this fix is needed for IE7- */
}
.footer_text {
font-size: 12px;
font-weight: bold;
letter-spacing: .2em;
padding: 0px;
margin: 0px;
}
.footer_nav_links {
margin-right: 2%;
}
.footer_icons {
font-size: 18px;
color: grey;
}
<div id="footer-navbar" class="container-fluid footer_text">
<div id="footer-navbar" class="container row footer navbar-fixed-bottom padding-top2 my-0 mx-auto padding-bottom2 ">
<div class="col-md-8">
<div class="">
<nav class="">
<div class="mx-auto d-sm-flex d-block flex-sm-nowrap">
<ul class="">
<li class="footer_nav_links">
<a class="" href="{% url 'shop:quienes_somos' %}">¿Quiénes somos?</a>
</li>
<li class="footer_nav_links">
<a class="" href="{% url 'shop:como_comprar' %}">¿Cómo comprar?</a>
</li>
<li class="footer_nav_links">
<a class="" href="{% url 'shop:contactanos' %}">Contáctanos</a>
</li>
</ul>
</div>
</nav>
<ul class="left footer-links footer-interact hidden-md-down">
<li><i class="fab fa-twitter footer_icons"></i></i></li>
<li><i class="fab fa-instagram footer_icons"></i></i></li>
<li><i class="fab fa-facebook-square footer_icons"></i></i></li>
<li><i class="fab fa-youtube footer_icons"></i></i></li>
</ul>
</div>
</div>
<div class="col-md-4 text-right">
<div class="">
<p><img src="{% static 'img/home/peru-flag.png' %}" width="40px" height="40px">Perú</p>
</div>
<div class="right footer-legal">
<span>© 2019 StickersGallito</span>
Privacy & Terms
</div>
</div>
</div>
</div>
</div>
</div>
Yes. The Left Col is set to col-md-8 and there is enough space. But the ul tag, which is the parent of all the footer_nav_links has a smaller width. You can add width: 100% for the ul tag to make its width equal to that of its parent which will open up space for the footer tags.
Modified Codepen
https://codepen.io/anon/pen/BeeNzY

Thumbnail image is not fitting the entire column when resizing

I have included a sidebar in one column and 3 thumbnails in another 3 columns in a row. The thumbnail image is fitting the entire columns at first but when I resize the thumbnail images are getting smaller keeping the column in full width (as for usual bootstrap responsive works). I need to stretch my images as that of the column they are filled in.
Here's my HTML:
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container-fluid side-navigation-bar">
<div class="row">
<!--==========================================-->
<!--Side navigation bar-->
<!--==========================================-->
<div class="col-md-3 col-md-3-thumbnail">
<div class="nav-side-menu" >
<div class="brand"><i class="fa fa-heartbeat"> myVitals.com</i></div>
<i class="fa fa-bars fa-2x toggle-btn" data-toggle="collapse" data-target="#menu-content"></i>
<div class="menu-list" >
<ul id="menu-content" class="menu-content collapse out" >
<li>
<a href="#">
<i class="fa fa-home fa-lg fa-fw"></i> Home
</a>
</li>
<li>
<a href="#">
<i class="fa fa-book fa-lg fa-fw"></i> My Appointments
</a>
</li>
<li>
<a href="#">
<i class="fa fa-s15 fa-lg fa-fw"></i> Facilities
</a>
</li>
<li>
<i class="fa fa-cogs fa-lg fa-fw"></i> Services
</li>
<li>
<i class="fa fa-stethoscope fa-lg fa-fw"></i> Doctors
</li>
<li>
<a href="#">
<i class="fa fa-medkit fa-lg fa-fw"></i> Medications
</a>
</li>
<li>
<a href="#">
<i class="fa fa-medkit fa-lg fa-fw"></i> Medications
</a>
</li>
</ul>
</div>
</div>
</div>
<!--==========================================-->
<!--End of Side navigation bar-->
<!--==========================================-->
<!--==========================================-->
<!--Cards-->
<!--==========================================-->
<div id="column" class="col-md-3 col-sm-6 col-md-3-thumbnail text-center">
<div class="thumbnail">
<figure class="imghvr-hinge-down">
<img src="http://via.placeholder.com/320x211" alt="Bootstrap Thumbnail Customization">
</figure>
<div class="caption">
<h5><b>Bootstrap Cards Design</b></h5>
<p class="card-description">Hi there How are you?</p>
<p>Read More</p>
</div>
</div>
</div>
<div id="column" class="col-md-3 col-sm-6 col-md-3-thumbnail text-center">
<div class="thumbnail">
<figure class="imghvr-hinge-down">
<img src="http://via.placeholder.com/320x211" alt="Bootstrap Thumbnail Customization">
</figure>
<div class="caption">
<h5><b>Bootstrap Cards Design</b></h5>
<p class="card-description">Hi there How are you?</p>
<p>Read More</p>
</div>
</div>
</div>
<div id="column" class="col-md-3 col-sm-6 col-md-3-thumbnail text-center">
<div class="thumbnail">
<figure class="imghvr-hinge-down">
<img src="http://via.placeholder.com/320x211" alt="Bootstrap Thumbnail Customization">
</figure>
<div class="caption">
<h5><b>Bootstrap Cards Design</b></h5>
<p class="card-description">Hi there How are you?</p>
<p>Read More</p>
</div>
</div>
</div>
</div>
</div>
I even tried the width:100% for the thumbnail image as
.thumbnail > img{width:100%; display:block;}
The problem is, the img is not taking the full-width as that of its column
Can anyone please help me???
Used .img-fluid for responsive image in Bootstrap.4. it have following css:
.img-fluid {
max-width: 100%;
height: auto;
}
https://getbootstrap.com/docs/4.0/content/images/
You can just set the width to 100% and the height to auto, this will expand it to full width.
CSS:
.thumbnail > figure > img {
width: 100%;
height: auto;
}
JSFiddle Demo

Why isn't my line divider and buttons on small screen mobile devices in proportion?

I was wondering why my buttons in the jsfiddle below and my line divider shown below in my jsfiddle isn't in line like my text on a mobile device such as the iPhone. For example, the outline of the buttons go each over each other and the line goes to the right side more and isn't equal on the users screen. How can I stop this from happening and ensure each part of the content on my web page is responsive/in proportion to what screen the user is viewing my site on.
Website code
Here is an example screenshot below of what I'm talking about.
As you can see in the code below, I have used bootstraps col could I have picked the wrong size of the container could this be the issue?
<div class="header1">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="header-content">
<h1 class="maintxt rotateInUpLeft animated">LIAM DOCHERTY</h1>
<h3 class="subtxt rotateInUpLeft animated">WEB DEVELOPER & GRAPHIC DESIGNER</h3>
<hr class="content-divider">
<ul class="list-inline intro-social-buttons">
<li>
<i class="fa fa-linkedin fa-fw"></i> <span class="network-name">Web Development Portfolio</span>
</li>
<li>
<i class="fa fa-linkedin fa-fw"></i> <span class="network-name">GFX Design Portfolio</span>
</li>
<li>
<i class="fa fa-linkedin fa-fw"></i> <span class="network-name">About Me</span>
</li>
<li>
<i class="fa fa-linkedin fa-fw"></i> <span class="network-name">Contact Me</span>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
You set a fixed width for hr class in CSS
.content-divider {
border-top: 1px solid #f8f8f8;
border-bottom: 1px solid rgba(0,0,0,0.2);
width: 790px;
}
This breaks the line divider on small screens.
For the buttons add a padding
ul.intro-social-buttons li {
padding-bottom: 10px;
}
https://jsfiddle.net/jktsmruc/3/

Getting rid of a list in a row

I'm trying to get rid of a bullet point in a row, but for some reason the first one is gone but the other is not.
I just want the email and phone to be side by side with no list.
.get_in {
list-style: none;
}
<div class="row">
<div class="col-md-6">
<ul class="get_in">
<li><i class="fa fa-envelope-o"></i>
<p>111111#hotmail.com</p>
</li>
</div>
<div class="col-md-6">
<li><i class="fa fa-phone"></i>
<p>(+41) 11111111</p>
</li>
</ul>
</div>
</div>
Just some messed up HTML. Close your first ul, create another for the second list and give the same class name.
.get_in {
list-style: none;
}
<div class="row">
<div class="col-md-6">
<ul class="get_in">
<li><i class="fa fa-envelope-o"></i>
<p>111111#hotmail.com</p>
</li>
</ul>
</div>
<div class="col-md-6">
<ul class="get_in">
<li><i class="fa fa-phone"></i>
<p>(+41) 11111111</p>
</li>
</ul>
</div>
</div>
Your HTML is invalid, and your browser is attempting to fill in the holes. If you inspect the actual rendered HTML in your browser's developer tools, you'll most likely see:
<div class="row">
<div class="col-md-6">
<ul class="get_in">
<li><i class="fa fa-envelope-o"></i><p>111111#hotmail.com</p></li>
</ul>
</div>
<div class="col-md-6">
<li><i class="fa fa-phone"></i><p>(+41) 11111111</p></li>
</div>
</div>
Note that in the second column the li is not wrapped with a ul, which is why your CSS rule does not apply.
I just want the email and phone to be side by side with no list
If this is the case, then don't use a list:
<div class="row">
<div class="col-md-6">
<i class="fa fa-envelope-o"></i> 111111#hotmail.com
</div>
<div class="col-md-6">
<i class="fa fa-phone"></i> (+41) 11111111
</div>
</div>
First, let's put your ul tag which opens, under the first div tag.
Second, let's put your ul tag which closes, between the last div and before the last div tags.
<div class="row">
<ul class="get_in">
<div class="col-md-6">
<li><i class="fa fa-envelope-o"></i><p>111111#hotmail.com</p></li>
</div>
<div class="col-md-6">
<li><i class="fa fa-phone"></i><p>(+41) 11111111</p></li>
</div>
</ul>
</div>
You can't open a ul element in one div and then close it in another div.
This is your HTML:
<div class="row">
<div class="col-md-6">
<ul class="get_in">
<li><i class="fa fa-envelope-o"></i><p>111111#hotmail.com</p></li>
</div>
<div class="col-md-6">
<li><i class="fa fa-phone"></i><p>(+41) 11111111</p></li>
</ul>
</div>
</div>
Change your HTML to:
<div class="row">
<div class="col-md-6">
<ul class="get_in">
<li><i class="fa fa-envelope-o"></i><p>111111#hotmail.com</p></li> </ul>
</div>
<div class="col-md-6">
<ul>
<li><i class="fa fa-phone"></i><p>(+41) 11111111</p></li>
</ul>
</div>
</div>
I hope that this has helped you.