flickity-fullscreen
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -9,4 +9,3 @@ { | ||
"dependencies": { | ||
"flickity": "^2.1.0", | ||
"tap-listener": "^2.0.0" | ||
"flickity": "^2.1.0" | ||
}, | ||
@@ -13,0 +12,0 @@ "authors": [ |
/*! | ||
* Flickity fullscreen v1.0.1 | ||
* Flickity fullscreen v1.1.0 | ||
* Enable fullscreen view for Flickity | ||
@@ -15,3 +15,2 @@ */ | ||
'flickity/js/index', | ||
'tap-listener/tap-listener', | ||
], factory ); | ||
@@ -21,4 +20,3 @@ } else if ( typeof module == 'object' && module.exports ) { | ||
module.exports = factory( | ||
require('flickity'), | ||
require('tap-listener') | ||
require('flickity') | ||
); | ||
@@ -28,8 +26,7 @@ } else { | ||
factory( | ||
window.Flickity, | ||
window.TapListener | ||
window.Flickity | ||
); | ||
} | ||
}( window, function factory( Flickity, TapListener ) { | ||
}( window, function factory( Flickity ) { | ||
@@ -92,2 +89,3 @@ 'use strict'; | ||
} | ||
this.dispatchEvent( 'fullscreenChange', null, [ isView ] ); | ||
}; | ||
@@ -130,12 +128,9 @@ | ||
// events | ||
// trigger viewFullscreen or exitFullscreen on button tap | ||
this.onTap = function() { | ||
// trigger viewFullscreen or exitFullscreen on click | ||
this.onClick = function() { | ||
flickity[ name + 'Fullscreen' ](); | ||
}; | ||
this.bindTap( this.element ); | ||
this.clickHandler = this.onClick.bind( this ); | ||
} | ||
FullscreenButton.prototype = Object.create( TapListener.prototype ); | ||
FullscreenButton.prototype.createButton = function() { | ||
@@ -176,3 +171,2 @@ var element = this.element = document.createElement('button'); | ||
FullscreenButton.prototype.activate = function() { | ||
this.on( 'tap', this.onTap ); | ||
this.element.addEventListener( 'click', this.clickHandler ); | ||
@@ -182,12 +176,6 @@ }; | ||
FullscreenButton.prototype.deactivate = function() { | ||
this.off( 'tap', this.onTap ); | ||
this.element.removeEventListener( 'click', this.clickHandler ); | ||
}; | ||
FullscreenButton.prototype.onClick = function() { | ||
var focused = document.activeElement; | ||
if ( focused && focused == this.element ) { | ||
this.onTap(); | ||
} | ||
}; | ||
Flickity.FullscreenButton = FullscreenButton; | ||
@@ -194,0 +182,0 @@ // ----- fin ----- // |
{ | ||
"name": "flickity-fullscreen", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Enable fullscreen view of Flickity carousels", | ||
@@ -8,4 +8,3 @@ "main": "fullscreen.js", | ||
"dependencies": { | ||
"flickity": "^2.1.0", | ||
"tap-listener": "^2.0.0" | ||
"flickity": "^2.1.0" | ||
}, | ||
@@ -12,0 +11,0 @@ "scripts": { |
@@ -131,4 +131,21 @@ # Flickity fullscreen | ||
## Events | ||
### fullscreenChange | ||
Triggered after entering or exiting the fullscreen view. | ||
``` js | ||
// jQuery | ||
$carousel.on( 'fullscreenChange.flickity', function( event, isFullscreen ) {...} ); | ||
// vanilla JS | ||
flkty.on( 'fullscreenChange', function( event, isFullscreen ) {...} ); | ||
``` | ||
- `event` · _Event_ · the `event` object | ||
- `isFullscreen` · _Boolean_ · `true` if viewing fullscreen, `false` if exiting fullscreen | ||
--- | ||
By [Metafizzy](https://metafizzy.co) 🌈🐻 |
24283
1
7
151
222
- Removedtap-listener@^2.0.0
- Removedtap-listener@2.0.0(transitive)