2

I have a Backbone view with a button that should make the view goto fullscreen on click. I'm using screenfull.js, and I cant see any different from the examples and my code. But console.log(screenfull.enabled); always return false in the clickHandler.

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);
  }
});

also without screenfull.js it dont g oto fullscreen:

goFullScreen: function() {

  var element = document.documentElement;

  if (element.requestFullScreen) {
    element.requestFullScreen();
  } else if (element.mozRequestFullScreen) {
    element.mozRequestFullScreen();
  } else if (element.webkitRequestFullScreen) {
    element.webkitRequestFullScreen();
  }

}
Andreas Köberle
  • 106,652
  • 57
  • 273
  • 297

1 Answers1

12

The problem is that the app runs in an iframe. Adding the allowFullScreen="true" attribute to the iframe fixes the bug.

Andreas Köberle
  • 106,652
  • 57
  • 273
  • 297