Unfold (Dropdown and others)

Toggle contextual overlays for displaying lists of links and more with the Nova unfold plugin.

Overview

Dropdowns are toggleable, contextual overlays for displaying lists of links and more. They're made interactive with the included Bootstrap dropdown style classes.

Accessibility

Dropdowns are toggleable, contextual overlays for displaying lists of links and more. They're made interactive with the included Bootstrap dropdown style classes.

The WAI ARIA standard defines an actual role="menu" widget, but this is specific to application-like menus which trigger actions or functions. ARIA menus can only contain menu items, checkbox menu items, radio button menu items, radio button groups, and sub-menus.

Nova's dropdowns, on the other hand, are designed to be generic and applicable to a variety of situations and markup structures. For instance, it is possible to create dropdowns that contain additional inputs and form controls, such as search fields or login forms. For this reason, Nova does not expect (nor automatically add) any of the role and aria- attributes required for true ARIA menus. Authors will have to include these more specific attributes themselves.

However, Nova does NOT add built-in support for most standard keyboard menu interactions, such as the ability to move through individual .dropdown-item elements using the cursor keys and close the menu with the ESC key. To avoid duplication, we use the Bootstrap classes with Nova dropdown (hs.unfold.js) JS.

How to use?

Wrap the unfold's toggle (your button or link) and the unfold menu within an element that declares position: relative;. Unfolds can be triggered from <a> or <button> elements to better fit your potential needs.

Copy-paste the following <script> near the end of your pages under JS Nova to enable it.

                      
                        <script src="../../assets/js/components/hs.unfold.js"></script>
                      
                    

Copy-paste the init function under JS Plugins Init., before the closing </body> tag, to enable it.

                      
                        <script>
                          $(document).on('ready', function () {
                            // initialization of unfold component
                            $.HSCore.components.HSUnfold.init($('[data-unfold-target]'));
                          });
                        </script>
                      
                    

Basic examples

Basic example with on hover effect.

                  
                    <div class="position-relative">
                      <a id="basicDropdownHoverInvoker" class="dropdown-nav-link dropdown-toggle" href="javascript:;" role="button"
                         aria-controls="basicDropdownHover"
                         aria-haspopup="true"
                         aria-expanded="false"
                         data-unfold-event="hover"
                         data-unfold-target="#basicDropdownHover"
                         data-unfold-type="css-animation"
                         data-unfold-duration="300"
                         data-unfold-delay="300"
                         data-unfold-hide-on-scroll="true"
                         data-unfold-animation-in="slideInUp"
                         data-unfold-animation-out="fadeOut">
                        Basic example
                      </a>

                      <div id="basicDropdownHover" class="dropdown-menu dropdown-unfold" aria-labelledby="basicDropdownHoverInvoker">
                        <a class="dropdown-item active" href="#">One</a>
                        <a class="dropdown-item" href="#">Two</a>
                        <a class="dropdown-item" href="#">Three</a>
                      </div>
                    </div>
                  
                

Another example with on click effect.

                  
                    <div class="position-relative">
                      <a id="basicDropdownClickInvoker" class="dropdown-nav-link dropdown-toggle" href="javascript:;" role="button"
                         aria-controls="basicDropdownClick"
                         aria-haspopup="true"
                         aria-expanded="false"
                         data-unfold-event="hover"
                         data-unfold-target="#basicDropdownClick"
                         data-unfold-type="css-animation"
                         data-unfold-duration="300"
                         data-unfold-delay="300"
                         data-unfold-hide-on-scroll="true"
                         data-unfold-animation-in="slideInUp"
                         data-unfold-animation-out="fadeOut">
                        Basic example
                      </a>

                      <div id="basicDropdownClick" class="dropdown-menu dropdown-unfold" aria-labelledby="basicDropdownClickInvoker">
                        <a class="dropdown-item active" href="#">One</a>
                        <a class="dropdown-item" href="#">Two</a>
                        <a class="dropdown-item" href="#">Three</a>
                      </div>
                    </div>
                  
                

Single button

Any single .btn can be turned into a dropdown toggle with some markup changes. Here's how you can put them to work with either <button> elements:

                  
                    <div class="position-relative">
                      <button id="dropdownSingleButtonInvoker" class="btn btn-sm btn-secondary dropdown-toggle" type="button"
                         aria-controls="dropdownSingleButton"
                         aria-haspopup="true"
                         aria-expanded="false"
                         data-unfold-target="#dropdownSingleButton"
                         data-unfold-type="css-animation"
                         data-unfold-duration="300"
                         data-unfold-delay="300"
                         data-unfold-hide-on-scroll="true"
                         data-unfold-animation-in="slideInUp"
                         data-unfold-animation-out="fadeOut">
                        Dropdown button
                      </button>

                      <div id="dropdownSingleButton" class="dropdown-menu dropdown-unfold" aria-labelledby="dropdownSingleButtonInvoker">
                        <a class="dropdown-item active" href="#">One</a>
                        <a class="dropdown-item" href="#">Two</a>
                        <a class="dropdown-item" href="#">Three</a>
                      </div>
                    </div>
                  
                

And with <a> elements:

                  
                    <div class="position-relative">
                      <a id="dropdownWithHrefInvoker" class="btn btn-sm btn-secondary dropdown-toggle" href="javascript:;" role="button"
                         aria-controls="dropdownWithHref"
                         aria-haspopup="true"
                         aria-expanded="false"
                         data-unfold-target="#dropdownWithHref"
                         data-unfold-type="css-animation"
                         data-unfold-duration="300"
                         data-unfold-delay="300"
                         data-unfold-hide-on-scroll="true"
                         data-unfold-animation-in="slideInUp"
                         data-unfold-animation-out="fadeOut">
                        Dropdown link
                      </a>

                      <div id="dropdownWithHref" class="dropdown-menu dropdown-unfold" aria-labelledby="dropdownWithHrefInvoker">
                        <a class="dropdown-item active" href="#">One</a>
                        <a class="dropdown-item" href="#">Two</a>
                        <a class="dropdown-item" href="#">Three</a>
                      </div>
                    </div>
                  
                

And with hover effect:

                  
                    <div class="position-relative">
                      <a id="dropdownOnHoverInvoker" class="btn btn-sm btn-secondary dropdown-toggle" href="javascript:;" role="button"
                         aria-controls="dropdownOnHover"
                         aria-haspopup="true"
                         aria-expanded="false"
                         data-unfold-event="hover"
                         data-unfold-target="#dropdownOnHover"
                         data-unfold-type="css-animation"
                         data-unfold-duration="300"
                         data-unfold-delay="300"
                         data-unfold-hide-on-scroll="true"
                         data-unfold-animation-in="slideInUp"
                         data-unfold-animation-out="fadeOut">
                        Dropdown on Hover
                      </a>

                      <div id="dropdownOnHover" class="dropdown-menu dropdown-unfold" aria-labelledby="dropdownOnHoverInvoker">
                        <a class="dropdown-item active" href="#">One</a>
                        <a class="dropdown-item" href="#">Two</a>
                        <a class="dropdown-item" href="#">Three</a>
                      </div>
                    </div>
                  
                

The best part is you can do this with any button variant, too:

                  
                    <div class="btn-group">
                      <div class="position-relative">
                        <a id="dropdownPrimaryInvoker" class="btn btn-sm btn-primary dropdown-toggle" href="javascript:;" role="button"
                           aria-controls="dropdownPrimary"
                           aria-haspopup="true"
                           aria-expanded="false"
                           data-unfold-target="#dropdownPrimary"
                           data-unfold-type="css-animation"
                           data-unfold-duration="300"
                           data-unfold-delay="300"
                           data-unfold-hide-on-scroll="true"
                           data-unfold-animation-in="slideInUp"
                           data-unfold-animation-out="fadeOut">
                          Primary
                        </a>

                        <div id="dropdownPrimary" class="dropdown-menu dropdown-unfold" aria-labelledby="dropdownPrimaryInvoker">
                          <a class="dropdown-item active" href="#">One</a>
                          <a class="dropdown-item" href="#">Two</a>
                          <a class="dropdown-item" href="#">Three</a>
                        </div>
                      </div>
                    </div>

                    <div class="btn-group">
                      <div class="position-relative">
                        <a id="dropdownSecondaryInvoker" class="btn btn-sm btn-secondary dropdown-toggle" href="javascript:;" role="button"
                           aria-controls="dropdownSecondary"
                           aria-haspopup="true"
                           aria-expanded="false"
                           data-unfold-target="#dropdownSecondary"
                           data-unfold-type="css-animation"
                           data-unfold-duration="300"
                           data-unfold-delay="300"
                           data-unfold-hide-on-scroll="true"
                           data-unfold-animation-in="slideInUp"
                           data-unfold-animation-out="fadeOut">
                          Secondary
                        </a>

                        <div id="dropdownSecondary" class="dropdown-menu dropdown-unfold" aria-labelledby="dropdownSecondaryInvoker">
                          <a class="dropdown-item active" href="#">One</a>
                          <a class="dropdown-item" href="#">Two</a>
                          <a class="dropdown-item" href="#">Three</a>
                        </div>
                      </div>
                    </div>

                    <div class="btn-group">
                      <div class="position-relative">
                        <a id="dropdownSuccessInvoker" class="btn btn-sm btn-success dropdown-toggle" href="javascript:;" role="button"
                           aria-controls="dropdownSuccess"
                           aria-haspopup="true"
                           aria-expanded="false"
                           data-unfold-target="#dropdownSuccess"
                           data-unfold-type="css-animation"
                           data-unfold-duration="300"
                           data-unfold-delay="300"
                           data-unfold-hide-on-scroll="true"
                           data-unfold-animation-in="slideInUp"
                           data-unfold-animation-out="fadeOut">
                          Success
                        </a>

                        <div id="dropdownSuccess" class="dropdown-menu dropdown-unfold" aria-labelledby="dropdownSuccessInvoker">
                          <a class="dropdown-item active" href="#">One</a>
                          <a class="dropdown-item" href="#">Two</a>
                          <a class="dropdown-item" href="#">Three</a>
                        </div>
                      </div>
                    </div>

                    <div class="btn-group">
                      <div class="position-relative">
                        <a id="dropdownWarningInvoker" class="btn btn-sm btn-warning dropdown-toggle" href="javascript:;" role="button"
                           aria-controls="dropdownWarning"
                           aria-haspopup="true"
                           aria-expanded="false"
                           data-unfold-target="#dropdownWarning"
                           data-unfold-type="css-animation"
                           data-unfold-duration="300"
                           data-unfold-delay="300"
                           data-unfold-hide-on-scroll="true"
                           data-unfold-animation-in="slideInUp"
                           data-unfold-animation-out="fadeOut">
                          Warning
                        </a>

                        <div id="dropdownWarning" class="dropdown-menu dropdown-unfold" aria-labelledby="dropdownWarningInvoker">
                          <a class="dropdown-item active" href="#">One</a>
                          <a class="dropdown-item" href="#">Two</a>
                          <a class="dropdown-item" href="#">Three</a>
                        </div>
                      </div>
                    </div>

                    <div class="btn-group">
                      <div class="position-relative">
                        <a id="dropdownInfoInvoker" class="btn btn-sm btn-info dropdown-toggle" href="javascript:;" role="button"
                           aria-controls="dropdownInfo"
                           aria-haspopup="true"
                           aria-expanded="false"
                           data-unfold-target="#dropdownInfo"
                           data-unfold-type="css-animation"
                           data-unfold-duration="300"
                           data-unfold-delay="300"
                           data-unfold-hide-on-scroll="true"
                           data-unfold-animation-in="slideInUp"
                           data-unfold-animation-out="fadeOut">
                          Info
                        </a>

                        <div id="dropdownInfo" class="dropdown-menu dropdown-unfold" aria-labelledby="dropdownInfoInvoker">
                          <a class="dropdown-item active" href="#">One</a>
                          <a class="dropdown-item" href="#">Two</a>
                          <a class="dropdown-item" href="#">Three</a>
                        </div>
                      </div>
                    </div>

                    <div class="btn-group">
                      <div class="position-relative">
                        <a id="dropdownDangerInvoker" class="btn btn-sm btn-danger dropdown-toggle" href="javascript:;" role="button"
                           aria-controls="dropdownDanger"
                           aria-haspopup="true"
                           aria-expanded="false"
                           data-unfold-target="#dropdownDanger"
                           data-unfold-type="css-animation"
                           data-unfold-duration="300"
                           data-unfold-delay="300"
                           data-unfold-hide-on-scroll="true"
                           data-unfold-animation-in="slideInUp"
                           data-unfold-animation-out="fadeOut">
                          Danger
                        </a>

                        <div id="dropdownDanger" class="dropdown-menu dropdown-unfold" aria-labelledby="dropdownDangerInvoker">
                          <a class="dropdown-item active" href="#">One</a>
                          <a class="dropdown-item" href="#">Two</a>
                          <a class="dropdown-item" href="#">Three</a>
                        </div>
                      </div>
                    </div>

                    <div class="btn-group">
                      <div class="position-relative">
                        <a id="dropdownIndigoInvoker" class="btn btn-sm btn-light dropdown-toggle" href="javascript:;" role="button"
                           aria-controls="dropdownIndigo"
                           aria-haspopup="true"
                           aria-expanded="false"
                           data-unfold-target="#dropdownIndigo"
                           data-unfold-type="css-animation"
                           data-unfold-duration="300"
                           data-unfold-delay="300"
                           data-unfold-hide-on-scroll="true"
                           data-unfold-animation-in="slideInUp"
                           data-unfold-animation-out="fadeOut">
                          Light
                        </a>

                        <div id="dropdownIndigo" class="dropdown-menu dropdown-unfold" aria-labelledby="dropdownIndigoInvoker">
                          <a class="dropdown-item active" href="#">One</a>
                          <a class="dropdown-item" href="#">Two</a>
                          <a class="dropdown-item" href="#">Three</a>
                        </div>
                      </div>
                    </div>
                  
                

Sidebar

By default, Nova .sidebar is right positioned. To left position the sidebar, add .sidebar--left modifier class to a parent, which also repositions the box-shadow style from right to left, and change the animation options data-unfold-animation-in="" along with data-unfold-animation-out="" from right to left. For example, data-unfold-animation-in="fadeInLeft".

					                  
					                    <!-- Account Sidebar Toggle Button -->
					                    <a id="sidebarNavToggler" class="btn btn-sm btn-secondary" href="javascript:;" role="button"
					                       aria-controls="sidebarContent"
					                       aria-haspopup="true"
					                       aria-expanded="false"
					                       data-unfold-event="click"
					                       data-unfold-hide-on-scroll="false"
					                       data-unfold-target="#sidebarContent"
					                       data-unfold-type="css-animation"
					                       data-unfold-animation-in="fadeInRight"
					                       data-unfold-animation-out="fadeOutRight"
					                       data-unfold-duration="500">
					                      Sidebar toggler
					                    </a>
					                    <!-- End Account Sidebar Toggle Button -->

                              <!-- Sidebar Navigation -->
                              <aside id="sidebarContent" class="sidebar sidebar-light sidebar-right sidebar-full-height unfold-css-animation unfold-hidden position-fixed" aria-labelledby="sidebarNavToggler">
                                <div class="d-flex flex-column h-100 p-3 p-md-4">
                                  <!-- Toggle Button -->
                                  <div class="d-flex align-items-center">
                                    <button type="button" class="close ml-auto"
                                            aria-controls="sidebarContent"
                                            aria-haspopup="true"
                                            aria-expanded="false"
                                            data-unfold-event="click"
                                            data-unfold-hide-on-scroll="false"
                                            data-unfold-target="#sidebarContent"
                                            data-unfold-type="css-animation"
                                            data-unfold-animation-in="fadeInRight"
                                            data-unfold-animation-out="fadeOutRight"
                                            data-unfold-duration="500">
                                      <span aria-hidden="true">×</span>
                                    </button>
                                  </div>
                                  <!-- End Toggle Button -->

                                  <!-- Content -->
                                  <div class="js-scrollbar">
                                    <div>
                                      <h4 class="h5">Sidebar content</h4>
                                      <p>This is where we sit down, grab a cup of coffee and dial in the details. Understanding the task at hand and ironing out the wrinkles is key.</p>
                                    </div>
                                  </div>
                                  <!-- End Content -->

                                  <!-- Footer -->
                                  <footer class="mt-auto">
                                    <ul class="list-inline mb-0">
                                      <li class="list-inline-item"><a href="#">Footer</a></li>
                                      <li class="list-inline-item"><a href="#">Links</a></li>
                                      <li class="list-inline-item"><a href="#">More links</a></li>
                                    </ul>
                                  </footer>
                                  <!-- End Footer -->
                                </div>
                              </aside>
                              <!-- End Sidebar Navigation -->
					                  
					                

JavaScript behavior

Callbacks

					            
					              afterOpen: function (invoker) {} - function
					              afterClose: function (invoker) {} - function
					            
					          

Methods

Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-, as in data-unfold-type="".

Attributes Description Default value

data-unfold-type

Show/hide effect.
If data-unfold-type="" is set to jquery-slide, the jQuery slideDown effect will be applied to the opening and slideUp to the close. If data-unfold-type="" is set to css-animation, then any effect from the library animate.css can be used.

data-unfold-target

Accepts the ID of the hidden element as a parameter.

data-unfold-event

Defines by what event the script will fire. Valid values are:
  • hover
  • click
click

data-unfold-duration

Specifies the duration of the animation. 300

data-unfold-easing

Determines the smoothness of the animation, if data-unfold-type="" is set to jquery-slide
  • linear
  • swing
jquery.easing.min.js plugin is required to extend the plugin.

Additional values:

  • easeInQuad
  • easeOutQuad
  • easeInOutQuad
  • easeInCubic
  • easeOutCubic
  • easeInOutCubic
  • easeInQuart
  • easeOutQuart
  • easeInOutQuart
  • easeInQuint
  • easeOutQuint
  • easeInOutQuint
  • easeInSine
  • easeOutSine
  • easeInOutSine
  • easeInExpo
  • easeOutExpo
  • easeInOutExpo
  • easeInCirc
  • easeOutCirc
  • easeInOutCirc
  • easeInElastic
  • easeOutElastic
  • easeInOutElastic
  • easeInBack
  • easeOutBack
  • easeInOutBack
  • easeInBounce
  • easeOutBounce
  • easeInOutBounce
linear

data-unfold-delay

Specifies the animation delay. 350

data-unfold-animation-in

Revealing animation effect, if data-unfold-type="" is set to css-animation.
To run the script, you must additionally link animate.css
All available animation values, can be found here
fadeIn

data-unfold-animation-out

Disappearing animation effect, if data-unfold-type="" is set to css-animation.
To run the script, you must additionally link animate.css
All available animation values, can be found here
fadeOut

data-unfold-hide-on-scroll

If true, enables hiding the content on scroll. true

data-unfold-hide-on-blur

If true, enables hiding the content with blur effect. false

afterOpen: function (invoker) {}

Executes the code inside the body of the function each time it is opened.

afterClose: function (invoker) {}

Executes the code inside the body of the function each time it is closed.