File: public/assets/js/plugins/metisMenu/jquery.metisMenu.js

Recommend this page to a friend!
  Classes of ikhsan  >  Slim Starter  >  public/assets/js/plugins/metisMenu/jquery.metisMenu.js  >  Download  
File: public/assets/js/plugins/metisMenu/jquery.metisMenu.js
Role: Auxiliary data
Content type: text/plain
Description: menu effect for admin dashboard
Class: Slim Starter
Build MVC Web applications based on Slim framework
Author: By
Last change:
Date: 6 years ago
Size: 1,386 bytes
 

Contents

Download
;(function ($, window, document, undefined) {

    var pluginName = "metisMenu",
        defaults = {
            toggle: true
        };
        
    function Plugin(element, options) {
        this.element = element;
        this.settings = $.extend({}, defaults, options);
        this._defaults = defaults;
        this._name = pluginName;
        this.init();
    }

    Plugin.prototype = {
        init: function () {

            var $this = $(this.element),
                $toggle = this.settings.toggle;

            $this.find('li.active').has('ul').children('ul').addClass('collapse in');
            $this.find('li').not('.active').has('ul').children('ul').addClass('collapse');

            $this.find('li').has('ul').children('a').on('click', function (e) {
                e.preventDefault();

                $(this).parent('li').toggleClass('active').children('ul').collapse('toggle');

                if ($toggle) {
                    $(this).parent('li').siblings().removeClass('active').children('ul.in').collapse('hide');
                }
            });
        }
    };

    $.fn[ pluginName ] = function (options) {
        return this.each(function () {
            if (!$.data(this, "plugin_" + pluginName)) {
                $.data(this, "plugin_" + pluginName, new Plugin(this, options));
            }
        });
    };

})(jQuery, window, document);

For more information send a message to info at phpclasses dot org.