扩展zurb Foundation 5 JavaScript插件

问题描述

对于一个非常老的客户项目,我想为网站扩展Foundation 5的javascript插件顶部栏的events方法。我通过npm拉[email protected]。 foundation5在[email protected]上运行。 插件看起来像这样:

;(function ($,window,document,undefined) {
  'use strict';

  Foundation.libs.topbar = {
    name : 'topbar',version : '5.5.3',settings : {
      index : 0,start_offset : 0,sticky_class : 'sticky',custom_back_text : true,back_text : 'Back',mobile_show_parent_link : true,is_hover : true,scrolltop : true,// jump to top when sticky nav menu toggle is clicked
      sticky_on : 'all',dropdown_autoclose: true
    },init : function (section,method,options) {
      Foundation.inherit(this,'add_custom_rule register_media throttle');
      var self = this;

      self.register_media('topbar','foundation-mq-topbar');
      ...
    },events: {...}
    ...
  };
}(jQuery,window.document));

现在我想重写events方法以更改事件回调之一的行为。因此,当我的用户单击选择框以选择某项时,顶部栏菜单下拉列表保持打开状态。标准行为是单击下拉菜单中的一项=关闭下拉菜单

.on('click.fndtn.topbar','[' + this.attr_name() + '] .has-dropdown>a',function (e) {...}

解决此问题,我需要插入一张额外的支票

if(li.hasClass('hover') && !settings.dropdown_autoclose) {
   return;
} 

我现在想做的是这样的:

/* Third party libs */
<script src="../../node_modules/jquery2/dist/jquery.min.js">
<script src="../../node_modules/foundation-sites-5/js/foundation.js">
/* customizing */
<script src="./js/foundation_customizing.js">

<script type="text/javascript">
    $(document).foundation();
</script>

我现在对jquery对待插件的了解不多。因此,我在尝试访问Foundation.libs.topbar.events时花了些时间,但似乎无法通过window对象直接访问。

所以请帮帮我。我该如何以jquery的方式覆盖该方法

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)