Sha256: 595f64034e065ae25c8ea0a14bb9b62a69b8cefc1343b3d360e62d30dfb53efd

Contents?: true

Size: 501 Bytes

Versions: 2

Compression:

Stored size: 501 Bytes

Contents

Plotline.Behaviors.Dropdown = {
  initialize: function() {
    $(document).ready(function() {
      $('[data-behavior~=dropdown] .nav-item').click(function(e) {
        $(this).siblings("ul").toggleClass("visible");
        e.preventDefault();
      });
    });

    $(window).click(function(event) {
      if (!$('[data-behavior~=dropdown]').has(event.target).length) {
        $('[data-behavior~=dropdown] ul').removeClass("visible");
      }
    });
  }
}

Plotline.Behaviors.Dropdown.initialize();

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
plotline-0.1.1 app/assets/javascripts/plotline/behaviors/dropdown.js
plotline-0.1.0 app/assets/javascripts/plotline/behaviors/dropdown.js