Implement fullScreen toggle mode for blueimp gallery plugin

This commit is contained in:
Hadi Nategh 2015-01-28 10:57:33 +00:00
parent 69ae4efb47
commit 9c9ef1b3d4
5 changed files with 43 additions and 7 deletions

View File

@ -163,11 +163,23 @@
.blueimp-gallery-playing > .play-pause { .blueimp-gallery-playing > .play-pause {
background-position: -15px 0; background-position: -15px 0;
} }
.blueimp-gallery > .fullscreen {
position: absolute;
right: 15px;
bottom: 30px;
width: 15px;
height: 15px;
background: url(../img/fullscreen.png) 0 0 no-repeat;
cursor: pointer;
opacity: 0.5;
display:none;
}
.blueimp-gallery > .prev:hover, .blueimp-gallery > .prev:hover,
.blueimp-gallery > .next:hover, .blueimp-gallery > .next:hover,
.blueimp-gallery > .close:hover, .blueimp-gallery > .close:hover,
.blueimp-gallery > .title:hover, .blueimp-gallery > .title:hover,
.blueimp-gallery > .play-pause:hover { .blueimp-gallery > .play-pause:hover,
.blueimp-gallery > .fullscreen:hover{
color: #fff; color: #fff;
opacity: 1; opacity: 1;
} }
@ -175,7 +187,8 @@
.blueimp-gallery-controls > .next, .blueimp-gallery-controls > .next,
.blueimp-gallery-controls > .close, .blueimp-gallery-controls > .close,
.blueimp-gallery-controls > .title, .blueimp-gallery-controls > .title,
.blueimp-gallery-controls > .play-pause { .blueimp-gallery-controls > .play-pause,
.blueimp-gallery-controls > .fullscreen{
display: block; display: block;
/* Fix z-index issues (controls behind slide element) on Android: */ /* Fix z-index issues (controls behind slide element) on Android: */
-webkit-transform: translateZ(0); -webkit-transform: translateZ(0);
@ -195,7 +208,8 @@
.blueimp-gallery > .prev, .blueimp-gallery > .prev,
.blueimp-gallery > .next, .blueimp-gallery > .next,
.blueimp-gallery > .close, .blueimp-gallery > .close,
.blueimp-gallery > .play-pause { .blueimp-gallery > .play-pause,
.blueimp-gallery > .fullscreen{
-webkit-user-select: none; -webkit-user-select: none;
-khtml-user-select: none; -khtml-user-select: none;
-moz-user-select: none; -moz-user-select: none;

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 407 B

View File

@ -91,6 +91,8 @@
closeClass: 'close', closeClass: 'close',
// The class for the "play-pause" toggle control: // The class for the "play-pause" toggle control:
playPauseClass: 'play-pause', playPauseClass: 'play-pause',
// The class fullscreen button control
fullscreenClass:'fullscreen',
// The list object property (or data attribute) with the object type: // The list object property (or data attribute) with the object type:
typeProperty: 'type', typeProperty: 'type',
// The list object property (or data attribute) with the object title: // The list object property (or data attribute) with the object title:
@ -113,6 +115,8 @@
toggleControlsOnReturn: true, toggleControlsOnReturn: true,
// Toggle the automatic slideshow interval on pressing the Space key: // Toggle the automatic slideshow interval on pressing the Space key:
toggleSlideshowOnSpace: true, toggleSlideshowOnSpace: true,
// Toggle fullscreen mode when slideshow is running
toggleFullscreenOnSlideShow: true,
// Navigate the gallery by pressing left and right on the keyboard: // Navigate the gallery by pressing left and right on the keyboard:
enableKeyboardNavigation: true, enableKeyboardNavigation: true,
// Close the gallery on pressing the Esc key: // Close the gallery on pressing the Esc key:
@ -865,6 +869,10 @@
// Click on "play-pause" control // Click on "play-pause" control
this.preventDefault(event); this.preventDefault(event);
this.toggleSlideshow(); this.toggleSlideshow();
}else if (isTarget(options.fullscreenClass)) {
// Click on "fullscreen" control
this.preventDefault(event);
this.toggleFullscreen();
} else if (parent === this.slidesContainer[0]) { } else if (parent === this.slidesContainer[0]) {
// Click on slide background // Click on slide background
this.preventDefault(event); this.preventDefault(event);
@ -1128,8 +1136,22 @@
toggleSlideshow: function () { toggleSlideshow: function () {
if (!this.interval) { if (!this.interval) {
this.play(); this.play();
if (this.options.toggleFullscreenOnSlideShow) this.requestFullScreen(this.container[0]);
} else { } else {
this.pause(); this.pause();
if (this.options.toggleFullscreenOnSlideShow) this.exitFullScreen();
}
},
toggleFullscreen: function ()
{
if (!this.getFullScreenElement())
{
this.requestFullScreen(this.container[0]);
}
else
{
this.exitFullScreen();
} }
}, },

File diff suppressed because one or more lines are too long