2
我有一个Backbone视图,并带有一个按钮,该按钮应使视图在点击时变为全屏。我正在使用screenfull.js,我看不出任何不同的例子和我的代码。但总是会在clickHandler中返回false
。不能从iframe切换到全屏模式
var FullScreenButton = Backbone.Marionette.ItemView.extend({
tagName: 'button',
initialize: function() {
this.$el.click(_.bind(this.goFullScreen, this));
},
goFullScreen: function() {
console.log(screenfull.enabled);
screenfull.request(this.options.container);
}
});
也没有screenfull.js它不克OTO全屏:
goFullScreen: function() {
var element = document.documentElement;
if (element.requestFullScreen) {
element.requestFullScreen();
} else if (element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if (element.webkitRequestFullScreen) {
element.webkitRequestFullScreen();
}
}
谢谢先生! – Syd