1

关于引导程序的弹出框和主干,我有一个奇怪的问题。

我的主干代码:

App.Views.UploadBox = Backbone.View.extend({
el: '#upload-box',

events: {
    'click #upload-file': 'openPicker',
    'change #upload-file-input': 'handleFileUpload'
    //'mouseover #upload-file': 'hoverMessage'

},

initialize: function () {
    this.uploader = this.$('#upload-file-input');
    this.$("#upload-file").popover({ title: 'some title', content: 'helo world' });
    this.button = this.$('#upload-file');
}, ...

上传框:

<div class="span2 offset1" id="cannon-upload-box">
  <a href="#" class="btn media-header span10" 
  id="upload-file" rel="popover">UploadFile</a>
  <input id="upload-file-input" 
  type="file" placeholder="Choose File" style="display: none">
</div>

代码应该做什么:当悬停在 a 元素(id=upload-file)上时,应该是一个弹出消息。

代码实际上在做什么:当悬停时什么都没有发生,但是当单击按钮时,主干动作会根据需要触发,而且弹出框跳转但作为一个常量元素!截图

谢谢您的帮助 (-:

4

1 回答 1

1

设置弹出框时需要触发选项,如下所示:

this.$("#upload-file").popover({ 
    title: 'some title',
    content: 'helo world' ,
    trigger: 'hover' // show up on hover default is 'click'
});

试试看!

于 2013-05-28T09:51:56.783 回答