schneikai
10/20/2015 - 4:37 PM

Webflow dropdowns proper destroy

Webflow dropdowns proper destroy

function destroy() {
    if($dropdowns) {
      $dropdowns.each(function(i, el) {
        var $el = $(el);
        var data = $.data(el, namespace);

        $el.off(namespace);
        if(data) {
          if(data.toggle) data.toggle.off(namespace);
          if(data.nav) data.nav.off(namespace);
        }

        $.removeData(el, namespace);
      });
      $dropdowns = null;
    }
  }