Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change the zoom-overlay position to fix #70 #78

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 19 additions & 18 deletions dist/zoom.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
/**
* zoom.js - It's the best way to zoom an image
* @version v0.0.2
* @version v0.0.3
* @link https://github.com/fat/zoom.js
* @license MIT
*/

+function ($) { "use strict";
;(function ($) {
"use strict";

/**
* The zoom service
*/
function ZoomService () {
this._activeZoom =
this._initialScrollPosition =
this._initialTouchPosition =
this._touchMoveListener = null
this._initialScrollPosition =
this._initialTouchPosition =
this._touchMoveListener = null

this._$document = $(document)
this._$window = $(window)
Expand Down Expand Up @@ -126,9 +127,9 @@
*/
function Zoom (img) {
this._fullHeight =
this._fullWidth =
this._overlay =
this._targetImageWrap = null
this._fullWidth =
this._overlay =
this._targetImageWrap = null

this._targetImage = img

Expand Down Expand Up @@ -163,7 +164,7 @@
this._overlay = document.createElement('div')
this._overlay.className = 'zoom-overlay'

document.body.appendChild(this._overlay)
this._targetImageWrap.parentNode.insertBefore(this._overlay, this._targetImageWrap)

this._calculateZoom()
this._triggerAnimation()
Expand Down Expand Up @@ -221,15 +222,15 @@
$(this._targetImage)
.css({
'-webkit-transform': targetTransform,
'-ms-transform': targetTransform,
'transform': targetTransform
'-ms-transform': targetTransform,
'transform': targetTransform
})

$(this._targetImageWrap)
.css({
'-webkit-transform': imageWrapTransform,
'-ms-transform': imageWrapTransform,
'transform': imageWrapTransform
'-ms-transform': imageWrapTransform,
'transform': imageWrapTransform
})

this._$body.addClass('zoom-overlay-open')
Expand All @@ -244,15 +245,15 @@
$(this._targetImage)
.css({
'-webkit-transform': '',
'-ms-transform': '',
'transform': ''
'-ms-transform': '',
'transform': ''
})

$(this._targetImageWrap)
.css({
'-webkit-transform': '',
'-ms-transform': '',
'transform': ''
'-ms-transform': '',
'transform': ''
})

if (!$.support.transition) {
Expand Down Expand Up @@ -282,4 +283,4 @@
new ZoomService().listen()
})

}(jQuery)
})(jQuery);
4 changes: 2 additions & 2 deletions dist/zoom.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 18 additions & 17 deletions js/zoom.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
+function ($) { "use strict";
;(function ($) {
"use strict";

/**
* The zoom service
*/
function ZoomService () {
this._activeZoom =
this._initialScrollPosition =
this._initialTouchPosition =
this._touchMoveListener = null
this._initialScrollPosition =
this._initialTouchPosition =
this._touchMoveListener = null

this._$document = $(document)
this._$window = $(window)
Expand Down Expand Up @@ -119,9 +120,9 @@
*/
function Zoom (img) {
this._fullHeight =
this._fullWidth =
this._overlay =
this._targetImageWrap = null
this._fullWidth =
this._overlay =
this._targetImageWrap = null

this._targetImage = img

Expand Down Expand Up @@ -156,7 +157,7 @@
this._overlay = document.createElement('div')
this._overlay.className = 'zoom-overlay'

document.body.appendChild(this._overlay)
this._targetImageWrap.parentNode.insertBefore(this._overlay, this._targetImageWrap)

this._calculateZoom()
this._triggerAnimation()
Expand Down Expand Up @@ -214,15 +215,15 @@
$(this._targetImage)
.css({
'-webkit-transform': targetTransform,
'-ms-transform': targetTransform,
'transform': targetTransform
'-ms-transform': targetTransform,
'transform': targetTransform
})

$(this._targetImageWrap)
.css({
'-webkit-transform': imageWrapTransform,
'-ms-transform': imageWrapTransform,
'transform': imageWrapTransform
'-ms-transform': imageWrapTransform,
'transform': imageWrapTransform
})

this._$body.addClass('zoom-overlay-open')
Expand All @@ -237,15 +238,15 @@
$(this._targetImage)
.css({
'-webkit-transform': '',
'-ms-transform': '',
'transform': ''
'-ms-transform': '',
'transform': ''
})

$(this._targetImageWrap)
.css({
'-webkit-transform': '',
'-ms-transform': '',
'transform': ''
'-ms-transform': '',
'transform': ''
})

if (!$.support.transition) {
Expand Down Expand Up @@ -275,4 +276,4 @@
new ZoomService().listen()
})

}(jQuery)
})(jQuery);