FooterTutorials

How to create a responsive footer in jQuery

How to create a responsive footer in jQuery

Before We Start

Every developer needs clean and modern elements to develop their websites, It contains pictures and a user interface element within a website. The most important one and the first section that the user sees when the user enters a website. How to create a responsive footer in jQuery

So if you are a person who wishes to develop a website, you have to know how to create that properly.

We are here to solve your problem. In this article we discuss how to create these elements. Before we start please read the below articles which easier you to understand the process, if you are new to development.

Step 1 – Add HTML

It’s too easy and simple. Just copy and paste below code in your HTML editor between <body> </body> tag.

<footer>
	<div class="wrap">
		<div class="upper_side contents">
			<ul class="flex">
				<li class="first_depth">
					<p class="title">SHOP</p>
					<ul class="second_depth">
							<li class="white">By Category</li>
							<li><a href="#">Shop Home</a></li>
							<li><a href="#">Mens</a></li>
							<li><a href="#">Wemens</a></li>
							<li><a href="#">Kids</a></li>
							<li><a href="#">Classics</a></li>
					</ul>
				</li>
				<li class="first_depth">
					<p class="title">SPORTS</p>
					<ul class="second_depth">
							<li><a href="#">Skate</a></li>
							<li><a href="#">Surf</a></li>
							<li><a href="#">Snow</a></li>
							<li><a href="#">BMX</a></li>
					</ul>
				</li>
				<li class="first_depth">
					<p class="title">SUPPORT</p>
					<ul class="second_depth">
							<li><a href="#">FAQs</a></li>
							<li><a href="#">Store Locator</a></li>
							<li><a href="#">Missing Points?</a></li>
							<li><a href="#">Do Not Sell My Info</a></li>
					</ul>
				</li>
				<li class="first_depth">
					<p class="title">COMPANY</p>
					<ul class="second_depth">
							<li><a href="#">Terms of Use</a></li>
							<li><a href="#">Privacy</a></li>
							<li><a href="#">Careers</a></li>
							<li><a href="#">About</a></li>
							<li><a href="#">CA Supply Chains Act</a></li>
							<li><a href="#">Sustainability</a></li>
							<li><a href="#">Affilites</a></li>
							<li><a href="#">Recall Info</a></li>
							<li><a href="#">Inclusion and Diversity</a></li>
					</ul>
				</li>
				<li class="first_depth">
					<p class="title">CONTACT</p>
					<ul class="second_depth">
						<li>
								<ul>
									<li><a href="#">Contact Us</a></li>
									<li><a href="#">Order Status</a></li>
								</ul>
						</li>
						<li>
							<em class="white">Address</em>
							<p>1588 South Coast Dr<br>Costa Mesa, CA 92626</p>
						</li>
						<li>
							<em class="white">Hours</em>
							<p>M - F 6:00am - 3:30pm PST </p>
						</li>	
					</ul>
				</li>
			</ul>
		</div>
		<div class="mid_side contents">
			<ul class="flex">
				<li>
					<p class="title">STORE LOCATOR</p>
					<ul class="second_depth">
						<li>
							<p>Find a Vans store near you</p>
							<button class="store">FIND A STORE</button>
						</li>
						<li></li>
					</ul>
				</li>
				<li>
					<p class="title">FOLLOW VANS</p>
					<ul class="second_depth flex sns">
						<li><a href="#"><i class="fab fa-facebook-f"></i></a></li>
						<li><a href="#"><i class="fab fa-twitter"></i></a></li>
						<li><a href="#"><i class="fab fa-youtube"></i></a></li>
						<li><a href="#"><i class="fab fa-instagram"></i></a></li>
					</ul>
				</li>
				<li>
					<p class="title">SUBSCRIBE</p>
					<ul class="second_depth">
						<li>
							<p>Receive product news and updates in your inbox.</p>
						</li>
						<li>
							<div class="input_box flex">
								<input type="text" placeholder="Email Address">
								<button><i class="fas fa-chevron-right"></i></button>
							</div>
						</li>
					</ul>
				</li>
			</ul>
		</div>
	</div>
</footer>

Step 2 – Add CSS

We use some external CSS link to this code. No need to worry about this, copy and paste below code between <style></style> tag.

<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css">
</head>

Copy and paste below code in your HTML editor between <style></style> tag.

<style>
@import url("https://fonts.googleapis.com/css2?family=Anton&display=swap");

/* common css */
body {
	font-size: 13px;
	font-weight: 300;
}
a {
	color: #ccc;
	text-decoration: none;
}
a:hover {
	color: #c9192e;
}
.flex {
	display: flex;
	justify-content: space-between;
}
.flex > li {
	flex: 1;
	margin-right: 16px;
}
.white {
	display: block;
	padding: 10px 0;
	color: #fff;
	font-weight: 500;
}
.title {
	display: block;
	margin-bottom: 8px;
	color: #fff;
	font-family: "Anton", sans-serif;
	font-size: 22px;
	letter-spacing: 1.4px;
}
button {
	color: #fff;
	font-size: 14px;
	background-color: #c9192e;
	border: none;
	transition: all 0.3s;
	cursor: pointer;
}
footer {
	width: 100%;
	height: 100%;
	color: #8d9293;
	background-color: #7b0648;
	background-image: linear-gradient(
		225deg,
		#7b0648 0%,
		#3f0771 50%,
		#064775 100%
	);
}

footer .wrap {
	width: 900px;
	margin: auto;
	padding: 40px 0;
}
footer .wrap .upper_side ul.flex li {
	padding: 4px 0;
}

/* mid box */
footer .wrap .mid_side {
	margin: 50px 0;
}
footer .wrap .mid_side ul.second_depth li p {
	margin: 12px 0;
}
footer .wrap .mid_side ul.second_depth li button.store {
	width: 200px;
	line-height: 3;
}
footer .wrap .mid_side ul.second_depth li button.store:hover {
	background-color: #a11425;
}
footer .wrap .mid_side ul.sns {
	width: 160px;
}
footer .wrap .mid_side ul.sns li {
	margin-right: 4px;
}
footer .wrap .mid_side ul.sns li a {
	position: relative;
	display: block;
	width: 18px;
	height: 18px;
	padding: 8px;
	background-color: #3e3e3e;
	transition: all 0.3s;
}
footer .wrap .mid_side ul.sns li:nth-child(1):hover a {
	background-color: #3b5998;
}
footer .wrap .mid_side ul.sns li:nth-child(2):hover a {
	background-color: #00aced;
}
footer .wrap .mid_side ul.sns li:nth-child(3):hover a {
	background-color: #b00;
}
footer .wrap .mid_side ul.sns li:nth-child(4):hover a {
	background-color: #517fa4;
}

footer .wrap .mid_side ul.sns li a i {
	color: #fff;
	font-size: 18px;
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
}

footer .wrap .mid_side ul li .input_box {
	width: 300px;
}
footer .wrap .mid_side ul li .input_box input {
	width: 250px;
	padding-left: 10px;
}
footer .wrap .mid_side ul li .input_box button {
	width: 50px;
	height: 36px;
}
footer .wrap .mid_side ul li .input_box button:hover {
	background-color: #000;
}
/* last box */
footer .wrap .lower_side {
	position: relative;
	width: 466px;
}
footer .wrap .lower_side ul.flex {
	align-items: flex-end;
}
footer .wrap .lower_side ul.flex li {
	margin-bottom: 8px;
	flex: none;
}
footer .wrap .lower_side li.logo {
	display: block;
	width: 132px;
	height: 70px;
	margin-bottom: 0px !important;
	background: url(https://www.vans.com/wcsstore/vans-storefront/images/logos/logo-white.svg)
		no-repeat center;
	background-size: cover;
}

/*==================================================================*/
@media all and (max-width: 1023px) and (min-width: 640px) {
	footer .wrap {
		width: 90%;
	}

	/* mid box */
	footer .wrap .mid_side ul.second_depth {
		margin-top: 14px;
	}
	footer .wrap .mid_side ul.second_depth li p {
		display: none;
	}
	footer .wrap .mid_side ul.second_depth li button.store {
		width: 160px;
	}
	footer .wrap .mid_side ul li .input_box {
		width: 230px;
	}
}

/*==================================================================*/
@media all and (max-width: 639px) {
	/* common css */
	.flex {
		flex-direction: column;
	}
	.title {
		font-size: 18px;
	}
	footer .wrap {
		width: 95%;
		min-width: 320px;
	}
	footer .wrap .upper_side ul.flex li {
		position: relative;
		padding: 8px 0;
	}
	footer .wrap .upper_side ul.flex li.first_depth > p:before {
		position: absolute;
		top: -1px;
		right: 0;
		padding: 5px 8px;
		content: "\f0d7";
		font-family: "Font Awesome 5 Free";
		font-weight: 900;
		color: #fff;
		font-size: 24px;
		cursor: pointer;
	}
	footer .wrap .upper_side ul.flex li.first_depth.on > p:before {
		transform: rotate(180deg);
	}
	footer .wrap .upper_side ul.flex li.first_depth > p:after {
		display: block;
		content: "";
		width: 100%;
		padding-top: 8px;
		border-bottom: 1px solid rgba(255, 255, 255, 0.5);
	}
	footer .wrap .upper_side ul.second_depth {
		height: 0;
		display: none;
	}
	footer .wrap .upper_side li.first_depth.on ul.second_depth {
		height: auto;
		display: block;
	}
	/* mid box */
	footer .wrap .mid_side {
		margin: 30px 0;
	}
	footer .wrap .mid_side ul.flex > li {
		margin: 10px 0;
	}
	footer .wrap .mid_side ul.second_depth li p {
		display: none;
	}
	footer .wrap .mid_side ul.second_depth li button.store {
		width: 100%;
		margin-top: 8px;
	}
	footer .wrap .mid_side ul.sns {
		flex-direction: row;
	}
	footer .wrap .mid_side ul li .input_box {
		width: 100%;
		flex-direction: row;
		margin-top: 12px;
	}
	footer .wrap .mid_side ul li .input_box input {
		width: 80%;
	}
	footer .wrap .mid_side ul li .input_box button {
		width: 20%;
	}
	/* last box */
	footer .wrap .lower_side {
		width: 100%;
	}
	footer .wrap .lower_side ul.flex {
		flex-direction: row;
		flex-wrap: wrap;
	}
}

</style>

Step 3 – Add JavaScript

We use some external JavaScript link to this code. No need to worry about this, copy and paste below code between <head></head> tag.

<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>

And also copy and paste below JavaScript code between <script></script> tag.

<script>
$(document).ready(function(){
	var accordionOpen = $('.first_depth p'),
			secondDepth = $('.second_depth');
	
	accordionOpen.on('click',function(){
			accordionOpen.closest('.first_depth').removeClass('on');
			$(this).closest('.first_depth').addClass('on');
			
	});
});
</script>

At the end we will have something like this. You can change fonts, colors, backgrounds and all things that you want. Enjoy it.

Your Output

How to create a responsive footer in jQuery

Video Tutorial

Please watch this video to better understand this tutorial and don’t forget to subscribe to our channel.


Help others to find out about this article on Social Media sites. If you have any doubt or any problem, don’t hesitate to contact us. Thereafter we will be able to help you and also make sure you bookmark our site on your browser.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button