Foundation CSS JavaScript Utilities
Last Updated :
23 Jul, 2025
Foundation JavaScript Utilities is a collection of tools that can be used to enhance the functionality of your Foundation website. To use Foundation JavaScript Utilities, you first need to include the foundation.js file in your website. Once you have done this, you can use the various utilities by calling the corresponding function. For example, to create a custom animation, you would use the Foundation.Move() function.
Syntax
The syntax for calling a Foundation JavaScript Utility function is as follows:
Foundation.[Utility Name]([Arguments]);
Selector Engine
Throttle and Debounce
Data Options
Media Queries
Example 1:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content=
"width=device-width, initial-scale=1.0">
<title>Foundation JS Utilities Example</title>
<link rel="stylesheet" href=
"https://cdnjs.cloudflare.com/ajax/libs/foundation/6.6.3/css/foundation.min.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="top-bar">
<div class="top-bar-left">
<ul class="dropdown menu" data-dropdown-menu>
<li class="menu-text">GeeksForGeeks</li>
<li>
<a href="#">Courses</a>
</li>
<li>
<a href="#">Tutorials</a>
<ul class="menu">
<li><a href="#">
Data Structure and Algorithm
</a></li>
<li><a href="#">System Design</a></li>
<li><a href="#">Web Development</a></li>
</ul>
</li>
<li>
<a href="#">Jobs</a>
<ul class="menu">
<li><a href="#">For Job Seekers</a></li>
<li><a href="#">For Recruiters</a></li>
</ul>
</li>
<li>
<a href="#">Contact</a>
</li>
</ul>
</div>
</div>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js">
</script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/foundation/6.6.3/js/foundation.min.js">
</script>
<script src="script.js"></script>
</body>
</html>
CSS
.top-bar, .top-bar ul {
background-color: white;
}
.menu{
color: green;
}
a,ul,li{
color: black;
}
a:hover{
color: green;
}
ul:hover{
color: green;
}
li:hover{
color: green;
}
JavaScript
$(document).foundation();
- In this example, we have included the Foundation CSS file using the CDN link provided, and the necessary JavaScript files for jQuery and Foundation. We have also added the required markup for a top bar navigation menu with a dropdown submenu.
- To ensure the Foundation JavaScript utilities work correctly, we have included the jQuery library before the Foundation JavaScript file. Finally, we have initialized the Foundation framework by calling $(document).foundation().
Output:

Example 2:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content=
"width=device-width, initial-scale=1.0">
<link rel="stylesheet" href=
"https://cdnjs.cloudflare.com/ajax/libs/foundation/6.6.3/css/foundation.min.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<h1>GeeksForGeeks</h1>
<p>Best Programming Languages</p>
<ul class="accordion" data-accordion>
<li class="accordion-item" data-accordion-item>
<a href="#" class="accordion-title">Java</a>
<div class="accordion-content" data-tab-content>
Java is a high-level, class-based,
object-oriented programming language
that is designed to have asfew
implementation dependencies as possible.
</div>
</li>
<li class="accordion-item" data-accordion-item>
<a href="#" class="accordion-title">Python</a>
<div class="accordion-content" data-tab-content>
Python is a high-level, general-purpose
programming language. Its design philosophy
emphasizes code readability with the use of
significant indentation via the off-side rule.
</div>
</li>
<li class="accordion-item" data-accordion-item>
<a href="#" class="accordion-title">C++</a>
<div class="accordion-content" data-tab-content>
C++ was designed with systems programming
and embedded, resource-constrained software
and large systems in mind, with performance,
efficiency, and flexibility of use as its
design highlights.
</div>
</li>
</ul>
</div>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js">
</script>
<script src=
"https://speedcf.cloudflareaccess.com/cdn-cgi/access/login/fallback-core-origin.speedcdnjs.com?kid=5bf8efc97d78564ad5710e878c66913f9a11dd374ea9a4a28ed5ba59bc6b60ad&redirect_url=%2Fajax%2Flibs%2Ffoundation%2F6.6.3%2Fjs%2Fvendor%2Fwhat-input.min.js&meta=eyJraWQiOiJiNzg3MjI1M2IxNjljNTliNGRmYTM4YjZjMzJmNGFmY2NkNjYwZDBiY2IxNDUyOW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EsDN0qPmAyZhmhUHP0eaXljmX4rXz9ZFefHbkhdOPWWNrprkwfA7T1Fjf-jgM9EzgdMx171eWebZjeRevZ7P2Nul9eYibU9nzLf2YIxLPVlGwsD0cL-AiXlZCyEC7yndCZFahG_4sUdtUCR4A">
</script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/foundation/6.6.3/js/foundation.min.js">
</script>
<script src="script.js"></script>
</body>
</html>
CSS
.container {
margin: 20px;
}
h1 {
color: green;
}
JavaScript
$(document).foundation();
- This example demonstrates the basic usage of the Foundation's accordion component. The example uses the Foundation CSS framework for styling and the Foundation JavaScript files to initialize the accordion functionality.
Output:

Reference: https://get.foundation/sites/docs/javascript-utilities.html.