diff --git a/jquery.fs.zoomer.css b/jquery.fs.zoomer.css index b5294c4..9675366 100644 --- a/jquery.fs.zoomer.css +++ b/jquery.fs.zoomer.css @@ -4,104 +4,107 @@ * http://formstone.it/components/zoomer/ * * Copyright 2014 Ben Plum; MIT Licensed - */ + */ html, body { -ms-content-zooming: none; -ms-touch-action: none; } .zoomer .zoomer-holder { -ms-touch-action: none; } - + .zoomer, .zoomer * { - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - -o-user-select: none; - user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + -o-user-select: none; + user-select: none; } - .zoomer { background: #eee url(jquery.fs.zoomer-loading.gif) no-repeat center; height: 100%; overflow: hidden; position: relative; width: 100%; - -webkit-transition: none; - -moz-transition: none; - -ms-transition: none; - -o-transition: none; - transition: none; - } - .zoomer .zoomer-positioner { margin: 0; height: 1px; position: absolute; width: 1px; } - .zoomer .zoomer-holder { box-shadow: 0 0 3px rgba(0, 0, 0, 0.5); opacity: 0; position: relative; - -webkit-transition: none; - -moz-transition: none; - -ms-transition: none; - -o-transition: none; - transition: none; - } - .zoomer .zoomer-image { cursor: move; float: left; height: 100%; width: 100%; - -webkit-transition: opacity 0.25 linear; - -moz-transition: opacity 0.25 linear; - -ms-transition: opacity 0.25 linear; - -o-transition: opacity 0.25 linear; - transition: opacity 0.25 linear; - } - .zoomer .zoomer-tiles { height: 100%; position: relative; width: 100%; } - .zoomer .zoomer-tile { height: auto; position: absolute; width: auto; } - - /* CONTROLS */ - .zoomer .zoomer-controls { background: rgba(0, 0, 0, 0.8); box-shadow: 0 0 5px rgba(0, 0, 0, 0.5); border-radius: 3px; padding: 5px; position: absolute; - -webkit-transition: opacity 0.25 linear; - -moz-transition: opacity 0.25 linear; - -ms-transition: opacity 0.25 linear; - -o-transition: opacity 0.25 linear; - transition: opacity 0.25 linear; - } - .zoomer .zoomer-controls span { border-radius: 3px; color: #fff; cursor: pointer; display: block; font-size: 20px; font-weight: bold; height: 30px; line-height: 30px; margin: 0; text-align: center; width: 30px; } - .zoomer .zoomer-controls .zoomer-next, - .zoomer .zoomer-controls .zoomer-previous { display: none; } - - .zoomer.zoomer-gallery .zoomer-controls .zoomer-next, - .zoomer.zoomer-gallery .zoomer-controls .zoomer-previous { display: block; } - - /* CONTROLS - TOP, BOTTOM */ - .zoomer .zoomer-controls-top, - .zoomer .zoomer-controls-bottom { left: 50%; margin: 0 0 0 -35px; } - .zoomer .zoomer-controls-top { bottom: auto; top: 10px; } - .zoomer .zoomer-controls-bottom { bottom: 10px; top: auto; } - - .zoomer.zoomer-gallery .zoomer-controls-top, - .zoomer.zoomer-gallery .zoomer-controls-bottom { margin: 0 0 0 -65px; } - - .zoomer .zoomer-controls-top span, - .zoomer .zoomer-controls-bottom span { float: left; } - .zoomer .zoomer-controls-top span:first-child, - .zoomer .zoomer-controls-bottom span:first-child { margin: 0 1px 0 0; } - - /* CONTROLS - LEFT, RIGHT, TOP LEFT, TOP RIGHT, BOTTOM LEFT, BOTTOM RIGHT */ - .zoomer .zoomer-controls-left, - .zoomer .zoomer-controls-top-left, - .zoomer .zoomer-controls-bottom-left - .zoomer .zoomer-controls-right, - .zoomer .zoomer-controls-top-right, - .zoomer .zoomer-controls-bottom-right { height: 71px; width: 40px; } - - .zoomer.zoomer-gallery .zoomer-controls-left, - .zoomer.zoomer-gallery .zoomer-controls-top-left, - .zoomer.zoomer-gallery .zoomer-controls-bottom-left - .zoomer.zoomer-gallery .zoomer-controls-right, - .zoomer.zoomer-gallery .zoomer-controls-top-right, - .zoomer.zoomer-gallery .zoomer-controls-bottom-right { height: 131px; } - - .zoomer .zoomer-controls-left, - .zoomer .zoomer-controls-right { margin: -35px 0 0 0; top: 50%; } - - .zoomer.zoomer-gallery .zoomer-controls-left, - .zoomer.zoomer-gallery .zoomer-controls-right { margin: -65px 0 0 0; } - - .zoomer .zoomer-controls-left { left: 10px; } - .zoomer .zoomer-controls-top-left { left: 10px; top: 10px; } - .zoomer .zoomer-controls-bottom-left { bottom: 10px; left: 10px; } - - .zoomer .zoomer-controls-right { right: 10px; } - .zoomer .zoomer-controls-top-right { right: 10px; top: 10px; } - .zoomer .zoomer-controls-bottom-right { bottom: 10px; right: 10px; } - - @media screen and (min-width: 980px) { - .zoomer .zoomer-controls span:hover { background: #000; } - } \ No newline at end of file + .zoomer { background: #eee url(jquery.fs.zoomer-loading.gif) no-repeat center; height: 100%; overflow: hidden; position: relative; width: 100%; + -webkit-transition: none; + -moz-transition: none; + -ms-transition: none; + -o-transition: none; + transition: none; + } + .zoomer .zoomer-positioner { margin: 0; height: 1px; position: absolute; width: 1px; } + .zoomer .zoomer-holder { box-shadow: 0 0 3px rgba(0, 0, 0, 0.5); opacity: 0; position: relative; + -webkit-transition: none; + -moz-transition: none; + -ms-transition: none; + -o-transition: none; + transition: none; + } + .zoomer .zoomer-image { cursor: move; float: left; height: 100%; width: 100%; + -webkit-transition: opacity 0.25 linear; + -moz-transition: opacity 0.25 linear; + -ms-transition: opacity 0.25 linear; + -o-transition: opacity 0.25 linear; + transition: opacity 0.25 linear; + } + .zoomer .zoomer-tiles { height: 100%; position: relative; width: 100%; } + .zoomer .zoomer-tile { height: auto; position: absolute; width: auto; } + + /* CONTROLS */ + .zoomer .zoomer-controls { background: rgba(0, 0, 0, 0.8); box-shadow: 0 0 5px rgba(0, 0, 0, 0.5); border-radius: 3px; padding: 5px; position: absolute; + -webkit-transition: opacity 0.25 linear; + -moz-transition: opacity 0.25 linear; + -ms-transition: opacity 0.25 linear; + -o-transition: opacity 0.25 linear; + transition: opacity 0.25 linear; + } + .zoomer .zoomer-controls span { border-radius: 3px; color: #fff; cursor: pointer; display: block; font-size: 20px; font-weight: bold; height: 30px; line-height: 24px; margin: 0; text-align: center; width: 30px; } + .zoomer .zoomer-controls span.zoomer-page {display:none;} + .zoomer .zoomer-controls span.zoomer-page input { width: 26px; text-align: center; color: black; font-size: 16px; height: 30px; } + .zoomer .zoomer-controls .zoomer-next, + .zoomer .zoomer-controls .zoomer-previous { display: none; } + + .zoomer.zoomer-gallery .zoomer-controls .zoomer-next, + .zoomer.zoomer-gallery .zoomer-controls .zoomer-page, + .zoomer.zoomer-gallery .zoomer-controls .zoomer-previous { display: block; } + + /* CONTROLS - TOP, BOTTOM */ + .zoomer .zoomer-controls-top, + .zoomer .zoomer-controls-bottom { left: 50%; margin: 0 0 0 -35px; } + .zoomer .zoomer-controls-top { bottom: auto; top: 10px; } + .zoomer .zoomer-controls-bottom { bottom: 10px; top: auto; } + + .zoomer.zoomer-gallery .zoomer-controls-top, + .zoomer.zoomer-gallery .zoomer-controls-bottom { margin: 0 0 0 -65px; } + + .zoomer .zoomer-controls-top span, + .zoomer .zoomer-controls-bottom span { float: left; } + .zoomer .zoomer-controls-top span:first-child, + .zoomer .zoomer-controls-bottom span:first-child { margin: 0 1px 0 0; } + + /* CONTROLS - LEFT, RIGHT, TOP LEFT, TOP RIGHT, BOTTOM LEFT, BOTTOM RIGHT */ + .zoomer .zoomer-controls-left, + .zoomer .zoomer-controls-top-left, + .zoomer .zoomer-controls-bottom-left + .zoomer .zoomer-controls-right, + .zoomer .zoomer-controls-top-right, + .zoomer .zoomer-controls-bottom-right { height: 71px; width: 40px; } + + .zoomer.zoomer-gallery .zoomer-controls-left, + .zoomer.zoomer-gallery .zoomer-controls-top-left, + .zoomer.zoomer-gallery .zoomer-controls-bottom-left + .zoomer.zoomer-gallery .zoomer-controls-right, + .zoomer.zoomer-gallery .zoomer-controls-top-right, + .zoomer.zoomer-gallery .zoomer-controls-bottom-right { height: 131px; } + + .zoomer .zoomer-controls-left, + .zoomer .zoomer-controls-right { margin: -35px 0 0 0; top: 50%; } + + .zoomer.zoomer-gallery .zoomer-controls-left, + .zoomer.zoomer-gallery .zoomer-controls-right { margin: -65px 0 0 0; } + + .zoomer .zoomer-controls-left { left: 10px; } + .zoomer .zoomer-controls-top-left { left: 10px; top: 10px; } + .zoomer .zoomer-controls-bottom-left { bottom: 10px; left: 10px; } + + .zoomer .zoomer-controls-right { right: 10px; } + .zoomer .zoomer-controls-top-right { right: 10px; top: 10px; } + .zoomer .zoomer-controls-bottom-right { bottom: 10px; right: 10px; } + + @media screen and (min-width: 980px) { + .zoomer .zoomer-controls span:hover { background: #000; } + } \ No newline at end of file diff --git a/jquery.fs.zoomer.js b/jquery.fs.zoomer.js index 4f22686..8f773c5 100644 --- a/jquery.fs.zoomer.js +++ b/jquery.fs.zoomer.js @@ -4,7 +4,7 @@ * http://formstone.it/components/zoomer/ * * Copyright 2014 Ben Plum; MIT Licensed - */ + */ ;(function ($, window) { "use strict"; @@ -20,6 +20,7 @@ * @param controls.postion [string] <"bottom"> "Position of default controls" * @param controls.zoomIn [string] <> "Custom zoom control selecter" * @param controls.zoomOut [string] <> "Custom zoom control selecter" + * @param controls.page [string] <> "Custom pagination control selecter" * @param controls.next [string] <> "Custom pagination control selecter" * @param controls.previous [string] <> "Custom pagination control selecter" * @param customClass [string] <''> "Class applied to instance" @@ -36,6 +37,7 @@ position: "bottom", zoomIn: null, zoomOut: null, + page: null, next: null, previous: null }, @@ -182,9 +184,9 @@ data.controls.$previous.off(".zoomer"); data.$target.removeClass("zoomer-element") - .data("zoomer", null) - .empty() - .append(data.originalDOM); + .data("zoomer", null) + .empty() + .append(data.originalDOM); } }); @@ -255,14 +257,14 @@ data.centerLeft = Math.round(data.frameWidth * 0.5); data.centerTop = Math.round(data.frameHeight * 0.5); - // Set minHeight and minWidth to naturals sizes - data.minHeight = data.naturalHeight; - data.minWidth = data.naturalWidth; + // Set minHeight and minWidth to naturals sizes + data.minHeight = data.naturalHeight; + data.minWidth = data.naturalWidth; - // Recalculate minimum sizes only when the natural size of the image is bigger than the frame size - marginalReal - if (data.naturalHeight > (data.frameHeight - data.marginReal) || data.naturalWidth > (data.frameWidth - data.marginReal)) { - data = _setMinimums(data); - } + // Recalculate minimum sizes only when the natural size of the image is bigger than the frame size - marginalReal + if (data.naturalHeight > (data.frameHeight - data.marginReal) || data.naturalWidth > (data.frameWidth - data.marginReal)) { + data = _setMinimums(data); + } } }); }, @@ -344,17 +346,19 @@ data.$zoomer = $(html); data.$target.addClass("zoomer-element") - .html(data.$zoomer); + .html(data.$zoomer); - if (data.controls.zoomIn || data.controls.zoomOut || data.controls.next || data.controls.previous) { + if (data.controls.zoomIn || data.controls.zoomOut || data.controls.next || data.controls.previous || data.controls.page) { data.controls.$zoomIn = $(data.controls.zoomIn); data.controls.$zoomOut = $(data.controls.zoomOut); + data.controls.$page = $(data.controls.page); data.controls.$next = $(data.controls.next); data.controls.$previous = $(data.controls.previous); } else { html = '