jQuery hc-offcanvas-nav Plugin Last Updated : 01 Aug, 2024 Comments Improve Suggest changes Like Article Like Report In this article, we will learn about jQuery hc-offcanvas-nav plugin which helps web developers to create toggled offcanvas navigation with flexible multi-level menu and sub-menu items. This plugin gives a few methods to control the offcanvas and is available for free. Download the jQuery hc-offcanvas-nav plugin, keep the required pre-compiled files in your working folder, and use them by adding in the head section of your HTML code as shown in the examples below.Instantiate the plugin: var Nav = $('#navID').hcOffcanvasNav();Example 1: In the following example, a simple web page is created in an HTML container. The HTML "ul" and "li" tags are used for listing different web pages with reference links. The developer can change the code and make it more nested as per the application requirements. In the JavaScript part of the code, the initialization of hc-offcanvas-nav plugin is done with some basic settings. More settings can be added and further explored.Example: html <!DOCTYPE html> <html> <head> <title>jQuery hc-offcanvas-nav Plugin</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <link rel="stylesheet" href= "https://fonts.googleapis.com/icon?family=Material+Icons"> <link rel="stylesheet" href= "https://fonts.googleapis.com/css?family=Raleway:200, 300, 400, 600, 700"> <link rel="stylesheet" href="demo.css"> <script src= "https://code.jquery.com/jquery-3.4.1.slim.min.js"> </script> <script src= "https://cdnjs.cloudflare.com/ajax/libs/knockout/3.5.0/knockout-min.js"> </script> <script src="hc-offcanvas-nav.js"> </script> </head> <body> <h2>GFG HC canvas Nav API</h2> <div id="container"> <nav id="navID"> <ul> <li><a href="#">Home</a></li> <li><a href="#">About Us</a></li> <li><a href="#">Services</a> <ul> <li><a href="#">Search Engine Optimization</a></li> <li><a href="#">Web development</a> <ul> <li><a href="#">Web design</a></li> <li><a href="#">Web content coding</a></li> </ul> </li> </ul> </li> <li><a href="#">Contact</a></li> </ul> </nav> <script> (function ($) { let Nav; // initialize hc-offcanvas-nav() Nav = $('#navID').hcOffcanvasNav({ levelTitles: true, closeOnClick: false, disableAt: false, }); // close event Nav.close(); })(jQuery); </script> </div> </body> </html> Output :Example 2: The following example demonstrates the use of various data attributes that are attached to the HTML elements. According to the usage of data attributes, the "About Us" page seems to be active and so on. Please refer below given output image for better understanding. html <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <link rel="stylesheet" href= "https://fonts.googleapis.com/icon?family=Material+Icons"> <link rel="stylesheet" href= "https://fonts.googleapis.com/css?family=Raleway:200, 300, 400, 600, 700"> <link rel="stylesheet" href="demo.css"> <script src= "https://code.jquery.com/jquery-3.4.1.slim.min.js"> </script> <script src= "https://cdnjs.cloudflare.com/ajax/libs/knockout/3.5.0/knockout-min.js"> </script> <script src="hc-offcanvas-nav.js"> </script> </head> <body> <nav id="navID"> <ul> <li data-nav-highlight> <a href="#">Home</a> </li> <li data-nav-active><a href="#">About Us</a> <ul data-nav-active> <li><a href="#">Projects</a></li> <li><a href="#">Services</a></li> </ul> </li> <li><a href="#">Contact</a></li> <li><a data-nav-close="false" href="#"> Add New Page </a></li> <li data-nav-custom-content> <p>Developers or designer's own custom content.</p> </li> </ul> </nav> <script> (function ($) { let Nav; // initialize hc-offcanvas-nav() Nav = $('#navID').hcOffcanvasNav({ levelTitles: true }); })(jQuery); </script> </body> </html> Output Comment More infoAdvertise with us Next Article jQuery hc-offcanvas-nav Plugin G geetanjali16 Follow Improve Article Tags : Web Technologies JQuery jQuery-Plugin Similar Reads jQuery Page Piling Plugin jQuery pagePiling.js plug-in is a rich feature available for programmers for piling more than one layout section, one over the other, and accessing each page by URL or mouse scrolling or side bullets navigation. This feature provides all type of smooth vertical, horizontal, and side navigations to t 5 min read jQuery | Flickerplate Plugin jQuery provides Flickerplate plugin that helps our programmers to create sliders for websites that can cycle through a list of background images along with dot navigation feature and animated arrows. The plugin consists of many more libraries that are responsible for touch detections and events such 5 min read jQuery Multiscroll Plugin jQuery provides multiscroll.js plugin which helps programmers to create split web pages along with divided multiple vertical scrolling panels.Note: Please download the jQuery multiscroll plugin to your working folder and include the required files in the head section of your code as shown below. Dow 3 min read jQuery RowGrid Plugin jQuery provides a very simple, user-friendly and responsive rowGrid plugin that helps programmers to display images in a straight row. It is very lightweighted and supports infinite scrolling feature. Real examples of rowGrid are Google+ images or Google image search that appears in a straight row g 4 min read jQuery Alertify Plugin jQuery framework provides alertify.js plugin that provides pre-designed customizable notification system along with interactive browser dialogs. This extensible and themeable plugin is very useful for developers providing an optimized version of alert messages with stacking up to feature. This small 5 min read jQuery Image ProgressBars Plugin In this article, we will learn how to implement image ProgressBar feature using the jQuery Image ProgressBar plugin. Note: Please download the jQuery Image ProgressBar plugin in the working folder and include the required files in the head section of your HTML code. <link href=âprogressbar.cssâ r 2 min read jQuery DrawSVG Plugin SVG or Scalar Vector Graphics is Extended Markup Language-based graphics supporting 2 dimensional animations of images enhancing interactiveness. The specifications of SVG are open standards by World Wide Web Consortium defined in XML text files. These files can be changed or created with any drawin 4 min read jQuery Tagsort Plugin jQuery provides Tagsort plugin that is used for displaying tags or filter elements based on different tags in a DOM. The plugin takes data-attributes of HTML page structure and dynamically creates user-friendly tags used for filtering elements. The filtration of elements are done in many ways that a 9 min read jQuery Logos Distort Plugin The jQuery provides LogosDistort plugin which helps in creating or animating a parallax environment for 3D scenes in the user browser. It uses full-page matrix3D perspective logos distortions for transforming base on mouse movement. You have to download the required files in the working folder so th 4 min read jQuery Filer Plugin jQuery provides a quick jQuery Filer uploader plugin for easy implementation of uploading the files. It provides features like instant uploading of files, file append, file removal, multiple selections, drag and drop support along with other file validations.Download the required files to include it 2 min read Like