弹出骨干视图

时间:2013-09-09 05:10:15

标签: javascript jquery backbone.js marionette

我有一个Backbone View渲染。现在我想要点击一个事件,我的整个骨干视图会弹出并在灯箱上渲染。

我想做的是:

var ViewerModuleAppView = Backbone.Marionette.ItemView.extend({

            //On Initialization of View, this.template = template_viewer_module.html.
            template: template,

            events: {
                'click #pop_out': 'popout'
            },
            popout: function(){
                //ViewerModuleAppView gets render on a PopOut Window(may be Lightbox).
            }

3 个答案:

答案 0 :(得分:1)

我可以看到你正在使用Backbone.Marionette,所以我要发一个木偶回答。 Bryan Mann在BackboneRails.com上为Marionette做了一系列精彩的截屏视频,同时也播放了一个涵盖灯箱主题的截屏视频。在这里观看:http://www.backbonerails.com/screencasts/building-dialogs-with-custom-regions

答案 1 :(得分:0)

可能会有一些其他事件与弹出窗口一起被触发。在弹出功能中检查e.preventDefault()。

答案 2 :(得分:0)

为了防止浏览器执行其他渲染操作,您可以使用

popout: function() { 
 //do actions( pop up light box)
 return false; 
}
 or
popout: function() {
  //do actions 
  event.preventDefault();
}
相关问题