text: $.widget("corecss.dropdown", {
  
      version: "1.0.0",
  
      options: {
          effect: 'slide',
          toggleElement: false,
          noClose: false,
          duration: CORE_ANIMATION_DURATION,
          onDrop: function(object){},
          onUp: function(object){}
      },
  
      _create: function(){
          var  that = this, element = this.element, o = this.options,
              menu = this.element,
              name = this.name,
              parent = this.element.parent();
  
          var toggle;
  
          this._setOptionsFromDOM();
  
          toggle = o.toggleElement ? $(o.toggleElement) : parent.children('.dropdown-toggle').length > 0 ? parent.children('.dropdown-toggle') : parent.children('a:nth-child(1)');
  
          toggle.on('click.'+name, function(e){
              parent.siblings(parent[0].tagName).removeClass("active-container");
              $(".active-container").removeClass("active-container");
  
              if (menu.css('display') === 'block' && !menu.hasClass('keep-open')) {
                  that._close(menu);
              } else {
                  $('[data-role=dropdown]').each(function(i, el){
                      if (!menu.parents('[data-role=dropdown]').is(el) && !$(el).hasClass('keep-open') && $(el).css('display') === 'block') {
                          that._close(el);
                      }
                  });
                  if (menu.hasClass('horizontal')) {
                      menu.css({
                          'visibility': 'hidden',
                          'display': 'block'
                      });
                      var item_length = $(menu.children('li')[0]).outerWidth();
                      //var item_length2 = $(menu.children('li')[0]).width();
                      menu.css({
                          'visibility': 'visible',
                          'display': 'none'
                      });
                      var menu_width = menu.children('li').length * item_length + (menu.children('li').length - 1);
                      menu.css('width', menu_width);
                  }
                  that._open(menu);
                  parent.addClass("active-container");
              }
              e.preventDefault();
              e.stopPropagation();
          });
  
          if (o.noClose === true) {
              menu.on('click', function (e) {
                  // e.preventDefault();
                  e.stopPropagation();
              });
          }
  
          $(menu).find('li.disabled a').on('click', function(e){
              e.preventDefault();
          });
  
          element.data('dropdown', this);
      },
  
      _open: function(el){
          var parent = this.element.parent(), o = this.options;
          var toggle = o.toggleElement ? $(o.toggleElement) : parent.children('.dropdown-toggle').length > 0 ? parent.children('.dropdown-toggle') : parent.children('a:nth-child(1)');
  
          switch (this.options.effect) {
              case 'fade': $(el).fadeIn(o.duration); break;
              case 'slide': $(el).slideDown(o.duration); break;
              default: $(el).show();
          }
          this._trigger("onOpen", null, el);
          toggle.addClass('active-toggle');
  
          if (typeof o.onDrop === 'function') {
              o.onDrop(el);
          } else {
              if (typeof window[o.onDrop] === 'function') {
                  window[o.onDrop](el);
              } else {
                  var result = eval("(function(){"+o.onDrop+"})");
                  result.call(el);
              }
          }
      },
  
      _close: function(el){
          var parent = $(el).parent(), o = this.options;
          var toggle = o.toggleElement ? $(o.toggleElement) : parent.children('.dropdown-toggle').length > 0 ? parent.children('.dropdown-toggle') : parent.children('a:nth-child(1)');
  
          switch (this.options.effect) {
              case 'fade': $(el).fadeOut(o.duration); break;
              case 'slide': $(el).slideUp(o.duration); break;
              default: $(el).hide();
          }
          this._trigger("onClose", null, el);
          toggle.removeClass('active-toggle');
  
          if (typeof o.onUp === 'function') {
              o.onUp(el);
          } else {
              if (typeof window[o.onUp] === 'function') {
                  window[o.onUp](el);
              } else {
                  var result = eval("(function(){"+o.onUp+"})");
                  result.call(el);
              }
          }
      },
  
      _setOptionsFromDOM: function(){
          var that = this, element = this.element, o = this.options;
  
          $.each(element.data(), function(key, value){
              if (key in o) {
                  try {
                      o[key] = $.parseJSON(value);
                  } catch (e) {
                      o[key] = value;
                  }
              }
          });
      },
  
      _destroy: function(){
      },
  
      _setOption: function(key, value){
          this._super('_setOption', key, value);
      }
  });
  
  $(document).on('click', function(e){
      $('[data-role=dropdown]').each(function(i, el){
          if (!$(el).hasClass('keep-open') && $(el).css('display')==='block') {
              var that = $(el).data('dropdown');
              that._close(el);
          }
      });
  });
  