【问题标题】:How can I bind to the saved event on Mercury?如何绑定到 Mercury 上的已保存事件?
【发布时间】:2011-12-15 21:29:46
【问题描述】:

我目前正在探索 Mercury JS,但似乎无法找到绑定到已保存事件的方法。

根据API docs,应该很简单:

Mercury.on("saved", function(event) { 
  // something here
}

...但这会引发错误!

以下也不起作用:

$(window).bind('mercury:saved', function() {
  // no joy here either :(
};

有什么线索吗?

【问题讨论】:

    标签: javascript jquery ruby-on-rails ruby-on-rails-3


    【解决方案1】:

    我遇到了同样的问题。我通过在mercury:ready事件中设置事件函数来解决它。

    试试

    jQuery(window).on('mercury:ready', function() { 
        Mercury.on('saved', function(){
           alert("It's working!");
       });
    });
    

    【讨论】:

      【解决方案2】:

      我遇到了同样的问题。

      jQuery(window).bind('mercury:ready', function() 
      

      正在工作,但是

      jQuery(window).bind('mercury:saved', function() 
      

      没有。

      有线,但清除浏览器缓存为我做了。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-01-21
        • 1970-01-01
        • 2016-02-26
        • 1970-01-01
        • 1970-01-01
        • 2016-07-19
        • 1970-01-01
        • 2012-05-02
        相关资源
        最近更新 更多