metafizzy / flickity-fullscreen

Enable fullscreen view for Flickity carousels
46 stars 17 forks source link

fullScreenchange listener not working? #7

Closed timbakkum closed 6 years ago

timbakkum commented 6 years ago

Hi David,

Thanks for all the great work. I'm having trouble using the fullScreenchange listener. I took one of your pens as an example to show it is not working for me: https://codepen.io/anon/pen/pVrGXz?editors=1111

Do you have any pens in which the callback to the listener does get executed?

edit: i figure this must be a new feature, but I don't see it in the latest version yet of https://unpkg.com/flickity-fullscreen@1.0.1/fullscreen.js will it be updated soon?

desandro commented 6 years ago

Ha! Looks like I documented this event, but never added it to the code itself. I'll add it to the next release. Sorry about that!

timbakkum commented 6 years ago

Ah, great, I thought I was doing something wrong. Any idea when we can expect this release? I'm hoping to use this feature in a current project :-)

desandro commented 6 years ago

This will be coming in the next couple weeks. Until then, you can add this duck-punch

var _changeFullscreen = Flickity.prototype._changeFullscreen;

Flickity.prototype._changeFullscreen = function( isFullscreen ) {
  if ( this.isFullscreen == isView ) {
    return;
  }
  _changeFullscreen.apply( this, arguments );
  this.dispatchEvent( 'fullscreenChange', null, [ isFullscreen ] );
};
Andres-Sanchez commented 6 years ago

Hi David,

I'm using it via npm, could you publish the update in the npm package?

Thanks for your awesome job.

desandro commented 6 years ago

flickity-fullscreen v1.1.0 has been released. fullscreenChange added to docs