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" >w3wiki</ 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().
Foundation CSS JavaScript Utilities
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.