MetisMenu does not work correctly in IE8 / 9

on this page http://jolaga.laohost.net/topsleva I use metisMenu to switch categories on the left. It works great with one small exception. In IE8 / 9, if I click the "+" sign, a submenu will open, but after that, if I click again, it will not disappear. Can someone help me on this? There are also some problems with loading in IE8, but I am posting it in another question.

+3
source share
2 answers

change jquery.metisMenu.js for this code, working in IE8 / 9!, the problem is the function minimize , than working badly in IE, I use slideUp , slideDown or slideToggle jQuery to solve this problem.

;(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('metis-open').css('display', 'block');
        $this.find('li').not('.active').has('ul').children('ul').addClass('metis-close').css('display', 'none');

        $this.find('li').has('ul').children('a').on('click', function (e) {
            e.preventDefault();
            $(this).parent('li').toggleClass('active').children('ul').slideToggle().toggleClass('metis-close').toggleClass('metis-open');

            if ($toggle) {
                $(this).parent('li').siblings().removeClass('active').children('ul.metis-open').slideUp().toggleClass('metis-open');
            }
        });
    }
};

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

})(jQuery, window, document);
+2
source

This problem was resolved in the new version of this plugin for IE8 and IE9.

Visit https://github.com/onokumus/metisMenu

I am the author of the changes.

0
source

All Articles