🛠️ Off Canvas: Building a Library

Hey ,

I'm thrilled to help you learn JavaScript. Unfortunately, you've landed on a page where you cannot access with your current purchase.

Please upgrade (use this link) access this content.

I'm super eager to help you learn more!

🛠️ Off Canvas: Building a Library

Off Canvas Menu can be an Automatic Library. It’s simple, and users don’t need any configuration.

We’ll start by copy-pasting the entire Off Canvas Menu’s code into a module file called off-canvas.js.

// off-canvas.js
// Place all the code we have here.

To import this module file, we need to add type="module" to main.js.

<!-- index.html -->
<script type="module" src="js/main.js"></script>

Then we import off-canvas.js in main.js.

// main.js
import './off-canvas.js'

The off-canvas menu should still work as before.

Off Canvas menu works as before.

And we’re done building an Automatic Library – you can include the Off Canvas Menu on any project as long as you write the required HTML and CSS.