npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dcdavidev/jquery-sidenav

v3.2.0

Published

A simple side nav written in jquery

Downloads

49

Readme

@dcdavidev/jquery-sidenav

A robust, flexible, and simple-to-use side navigation plugin for jQuery. Designed to mimic modern mobile application sidebars, it handles everything from basic animations to page freezing and background masks.

Features

  • 📱 Mobile-Ready: Smooth animations optimized for a native-like feel.
  • ⚙️ Highly Configurable: Control width, alignment, animation easing, and more.
  • 🧊 Page Freezing: Optionally prevent background scrolling when the menu is open.
  • 🎭 Auto-Masking: Automatically generates a clickable background mask to close the menu.
  • ⌨️ TypeScript Powered: Fully typed for a better developer experience.

Installation

Install the package via your preferred package manager:

# pnpm
pnpm add @dcdavidev/jquery-sidenav

# npm
npm install @dcdavidev/jquery-sidenav

# yarn
yarn add @dcdavidev/jquery-sidenav

Dependencies

This plugin requires jQuery (v4.0+) and jQuery UI (for animation easing).

<script src="https://code.jquery.com/jquery-4.0.0.min.js"></script>
<script src="https://code.jquery.com/ui/1.14.0/jquery-ui.min.js"></script>

Quick Start

1. HTML Structure

Your sidebar needs a trigger (toggler) and the navigation container itself.

<!-- The App Bar / Header -->
<header>
  <button id="toggle-sidenav">Menu</button>
</header>

<!-- The Sidenav -->
<nav id="sidenav">
  <div class="sidenav-wrapper">
    <button class="quit-sidenav">Close Menu</button>
    <ul>
      <li><a href="#">Home</a></li>
      <li><a href="#">About</a></li>
      <li><a href="#">Contact</a></li>
    </ul>
  </div>
</nav>

2. Basic Initialization

Initialize the plugin by targeting your sidenav element:

$(document).ready(function () {
  $('#sidenav').sidenav({
    toggler: '#toggle-sidenav',
    quitter: '.quit-sidenav',
  });
});

Advanced Usage

Handling Content Overflow

By default, the sidenav has a fixed height. If your menu is long, you should wrap your content in a container with scrolling enabled:

#sidenav .sidenav-wrapper {
  height: 100%;
  overflow-y: auto;
}

Using Event Callbacks

You can hook into the lifecycle of the sidenav to trigger custom logic:

$('#sidenav').sidenav({
  toggler: '#toggle-sidenav',
  events: {
    onOpen: function () {
      console.log('Sidenav is starting to open!');
    },
    afterClose: function () {
      console.log('Sidenav is now fully closed.');
    },
    always: function () {
      // Triggered on every state change
      $('#toggle-sidenav').toggleClass('is-active');
    },
  },
});

Options

| Option | Type | Default | Description | | :------------------- | :------------------ | :-------- | :-------------------------------------------------------------------------- | | toggler | string | '' | Required. Selector for the element that toggles the menu. | | quitter | string | 'a' | Selector for elements inside the menu that will close it when clicked. | | align | 'left' \| 'right' | 'left' | Which side the menu appears on. | | width | number | 300 | Width of the menu in pixels. | | gap | number | 64 | The minimum gap left between the menu and the screen edge on small devices. | | open | boolean | false | Whether the menu should be open on initialization. | | zIndex | number | 3000 | The z-index of the sidenav element. | | freezePage | boolean | true | Set body overflow to hidden when the menu is open. | | animation.duration | number | 500 | Animation speed in milliseconds. | | animation.easing | string | 'swing' | jQuery UI easing function name. | | mask.display | boolean | true | Whether to show the background overlay. | | mask.css | object | See below | Custom CSS for the mask element. |

Default Mask CSS

{
  backgroundColor: 'black',
  opacity: 0.5,
  filter: 'Alpha(opacity=50)'
}

License

MIT © Davide Di Criscito