| 4 |
lars |
1 |
/*
|
|
|
2 |
* jQuery elevateZoom 3.0.8
|
|
|
3 |
* Demo's and documentation:
|
|
|
4 |
* www.elevateweb.co.uk/image-zoom
|
|
|
5 |
*
|
|
|
6 |
* Copyright (c) 2012 Andrew Eades
|
|
|
7 |
* www.elevateweb.co.uk
|
|
|
8 |
*
|
|
|
9 |
* Dual licensed under the GPL and MIT licenses.
|
|
|
10 |
* http://en.wikipedia.org/wiki/MIT_License
|
|
|
11 |
* http://en.wikipedia.org/wiki/GNU_General_Public_License
|
|
|
12 |
*
|
|
|
13 |
|
|
|
14 |
/*
|
|
|
15 |
* jQuery elevateZoom 3.0.3
|
|
|
16 |
* Demo's and documentation:
|
|
|
17 |
* www.elevateweb.co.uk/image-zoom
|
|
|
18 |
*
|
|
|
19 |
* Copyright (c) 2012 Andrew Eades
|
|
|
20 |
* www.elevateweb.co.uk
|
|
|
21 |
*
|
|
|
22 |
* Dual licensed under the GPL and MIT licenses.
|
|
|
23 |
* http://en.wikipedia.org/wiki/MIT_License
|
|
|
24 |
* http://en.wikipedia.org/wiki/GNU_General_Public_License
|
|
|
25 |
*/
|
|
|
26 |
|
|
|
27 |
|
|
|
28 |
if ( typeof Object.create !== 'function' ) {
|
|
|
29 |
Object.create = function( obj ) {
|
|
|
30 |
function F() {};
|
|
|
31 |
F.prototype = obj;
|
|
|
32 |
return new F();
|
|
|
33 |
};
|
|
|
34 |
}
|
|
|
35 |
|
|
|
36 |
(function( $, window, document, undefined ) {
|
|
|
37 |
var ElevateZoom = {
|
|
|
38 |
init: function( options, elem ) {
|
|
|
39 |
var self = this;
|
|
|
40 |
|
|
|
41 |
self.elem = elem;
|
|
|
42 |
self.$elem = $( elem );
|
|
|
43 |
|
|
|
44 |
self.imageSrc = self.$elem.data("zoom-image") ? self.$elem.data("zoom-image") : self.$elem.attr("src");
|
|
|
45 |
|
|
|
46 |
self.options = $.extend( {}, $.fn.elevateZoom.options, options );
|
|
|
47 |
|
|
|
48 |
//TINT OVERRIDE SETTINGS
|
|
|
49 |
if(self.options.tint) {
|
|
|
50 |
self.options.lensColour = "none", //colour of the lens background
|
|
|
51 |
self.options.lensOpacity = "1" //opacity of the lens
|
|
|
52 |
}
|
|
|
53 |
//INNER OVERRIDE SETTINGS
|
|
|
54 |
if(self.options.zoomType == "inner") {self.options.showLens = false;}
|
|
|
55 |
|
|
|
56 |
|
|
|
57 |
//Remove alt on hover
|
|
|
58 |
|
|
|
59 |
self.$elem.parent().removeAttr('title').removeAttr('alt');
|
|
|
60 |
|
|
|
61 |
self.zoomImage = self.imageSrc;
|
|
|
62 |
|
|
|
63 |
self.refresh( 1 );
|
|
|
64 |
|
|
|
65 |
|
|
|
66 |
//Create the image swap from the gallery
|
|
|
67 |
$('#'+self.options.gallery + ' a').click( function(e) {
|
|
|
68 |
|
|
|
69 |
//Set a class on the currently active gallery image
|
|
|
70 |
if(self.options.galleryActiveClass){
|
|
|
71 |
$('#'+self.options.gallery + ' a').removeClass(self.options.galleryActiveClass);
|
|
|
72 |
$(this).addClass(self.options.galleryActiveClass);
|
|
|
73 |
}
|
|
|
74 |
//stop any link on the a tag from working
|
|
|
75 |
e.preventDefault();
|
|
|
76 |
|
|
|
77 |
//call the swap image function
|
|
|
78 |
if($(this).data("zoom-image")){self.zoomImagePre = $(this).data("zoom-image")}
|
|
|
79 |
else{self.zoomImagePre = $(this).data("image");}
|
|
|
80 |
self.swaptheimage($(this).data("image"), self.zoomImagePre);
|
|
|
81 |
return false;
|
|
|
82 |
});
|
|
|
83 |
|
|
|
84 |
},
|
|
|
85 |
|
|
|
86 |
refresh: function( length ) {
|
|
|
87 |
var self = this;
|
|
|
88 |
|
|
|
89 |
setTimeout(function() {
|
|
|
90 |
self.fetch(self.imageSrc);
|
|
|
91 |
|
|
|
92 |
}, length || self.options.refresh );
|
|
|
93 |
},
|
|
|
94 |
|
|
|
95 |
fetch: function(imgsrc) {
|
|
|
96 |
//get the image
|
|
|
97 |
var self = this;
|
|
|
98 |
var newImg = new Image();
|
|
|
99 |
newImg.onload = function() {
|
|
|
100 |
//set the large image dimensions - used to calculte ratio's
|
|
|
101 |
self.largeWidth = newImg.width;
|
|
|
102 |
self.largeHeight = newImg.height;
|
|
|
103 |
//once image is loaded start the calls
|
|
|
104 |
self.startZoom();
|
|
|
105 |
self.currentImage = self.imageSrc;
|
|
|
106 |
//let caller know image has been loaded
|
|
|
107 |
self.options.onZoomedImageLoaded(self.$elem);
|
|
|
108 |
}
|
|
|
109 |
newImg.src = imgsrc; // this must be done AFTER setting onload
|
|
|
110 |
|
|
|
111 |
return;
|
|
|
112 |
|
|
|
113 |
},
|
|
|
114 |
|
|
|
115 |
startZoom: function( ) {
|
|
|
116 |
var self = this;
|
|
|
117 |
//get dimensions of the non zoomed image
|
|
|
118 |
self.nzWidth = self.$elem.width();
|
|
|
119 |
self.nzHeight = self.$elem.height();
|
|
|
120 |
|
|
|
121 |
//activated elements
|
|
|
122 |
self.isWindowActive = false;
|
|
|
123 |
self.isLensActive = false;
|
|
|
124 |
self.isTintActive = false;
|
|
|
125 |
self.overWindow = false;
|
|
|
126 |
|
|
|
127 |
//CrossFade Wrappe
|
|
|
128 |
if(self.options.imageCrossfade){
|
|
|
129 |
self.zoomWrap = self.$elem.wrap('<div style="height:'+self.nzHeight+'px;width:'+self.nzWidth+'px;" class="zoomWrapper" />');
|
|
|
130 |
self.$elem.css('position', 'absolute');
|
|
|
131 |
}
|
|
|
132 |
|
|
|
133 |
self.zoomLock = 1;
|
|
|
134 |
self.scrollingLock = false;
|
|
|
135 |
self.changeBgSize = false;
|
|
|
136 |
self.currentZoomLevel = self.options.zoomLevel;
|
|
|
137 |
|
|
|
138 |
|
|
|
139 |
//get offset of the non zoomed image
|
|
|
140 |
self.nzOffset = self.$elem.offset();
|
|
|
141 |
//calculate the width ratio of the large/small image
|
|
|
142 |
self.widthRatio = (self.largeWidth/self.currentZoomLevel) / self.nzWidth;
|
|
|
143 |
self.heightRatio = (self.largeHeight/self.currentZoomLevel) / self.nzHeight;
|
|
|
144 |
|
|
|
145 |
|
|
|
146 |
//if window zoom
|
|
|
147 |
if(self.options.zoomType == "window") {
|
|
|
148 |
self.zoomWindowStyle = "overflow: hidden;"
|
|
|
149 |
+ "background-position: 0px 0px;text-align:center;"
|
|
|
150 |
+ "background-color: " + String(self.options.zoomWindowBgColour)
|
|
|
151 |
+ ";width: " + String(self.options.zoomWindowWidth) + "px;"
|
|
|
152 |
+ "height: " + String(self.options.zoomWindowHeight)
|
|
|
153 |
+ "px;float: left;"
|
|
|
154 |
+ "background-size: "+ self.largeWidth/self.currentZoomLevel+ "px " +self.largeHeight/self.currentZoomLevel + "px;"
|
|
|
155 |
+ "display: none;z-index:100;"
|
|
|
156 |
+ "border: " + String(self.options.borderSize)
|
|
|
157 |
+ "px solid " + self.options.borderColour
|
|
|
158 |
+ ";background-repeat: no-repeat;"
|
|
|
159 |
+ "position: absolute;";
|
|
|
160 |
}
|
|
|
161 |
|
|
|
162 |
|
|
|
163 |
//if inner zoom
|
|
|
164 |
if(self.options.zoomType == "inner") {
|
|
|
165 |
//has a border been put on the image? Lets cater for this
|
|
|
166 |
|
|
|
167 |
var borderWidth = self.$elem.css("border-left-width");
|
|
|
168 |
|
|
|
169 |
self.zoomWindowStyle = "overflow: hidden;"
|
|
|
170 |
+ "margin-left: " + String(borderWidth) + ";"
|
|
|
171 |
+ "margin-top: " + String(borderWidth) + ";"
|
|
|
172 |
+ "background-position: 0px 0px;"
|
|
|
173 |
+ "width: " + String(self.nzWidth) + "px;"
|
|
|
174 |
+ "height: " + String(self.nzHeight)
|
|
|
175 |
+ "px;float: left;"
|
|
|
176 |
+ "display: none;"
|
|
|
177 |
+ "cursor:"+(self.options.cursor)+";"
|
|
|
178 |
+ "px solid " + self.options.borderColour
|
|
|
179 |
+ ";background-repeat: no-repeat;"
|
|
|
180 |
+ "position: absolute;";
|
|
|
181 |
}
|
|
|
182 |
|
|
|
183 |
|
|
|
184 |
|
|
|
185 |
//lens style for window zoom
|
|
|
186 |
if(self.options.zoomType == "window") {
|
|
|
187 |
|
|
|
188 |
|
|
|
189 |
// adjust images less than the window height
|
|
|
190 |
|
|
|
191 |
if(self.nzHeight < self.options.zoomWindowWidth/self.widthRatio){
|
|
|
192 |
lensHeight = self.nzHeight;
|
|
|
193 |
}
|
|
|
194 |
else{
|
|
|
195 |
lensHeight = String((self.options.zoomWindowHeight/self.heightRatio))
|
|
|
196 |
}
|
|
|
197 |
if(self.largeWidth < self.options.zoomWindowWidth){
|
|
|
198 |
lensWidth = self.nzWidth;
|
|
|
199 |
}
|
|
|
200 |
else{
|
|
|
201 |
lensWidth = (self.options.zoomWindowWidth/self.widthRatio);
|
|
|
202 |
}
|
|
|
203 |
|
|
|
204 |
|
|
|
205 |
self.lensStyle = "background-position: 0px 0px;width: " + String((self.options.zoomWindowWidth)/self.widthRatio) + "px;height: " + String((self.options.zoomWindowHeight)/self.heightRatio)
|
|
|
206 |
+ "px;float: right;display: none;"
|
|
|
207 |
+ "overflow: hidden;"
|
|
|
208 |
+ "z-index: 999;"
|
|
|
209 |
+ "-webkit-transform: translateZ(0);"
|
|
|
210 |
+ "opacity:"+(self.options.lensOpacity)+";filter: alpha(opacity = "+(self.options.lensOpacity*100)+"); zoom:1;"
|
|
|
211 |
+ "width:"+lensWidth+"px;"
|
|
|
212 |
+ "height:"+lensHeight+"px;"
|
|
|
213 |
+ "background-color:"+(self.options.lensColour)+";"
|
|
|
214 |
+ "cursor:"+(self.options.cursor)+";"
|
|
|
215 |
+ "border: "+(self.options.lensBorderSize)+"px" +
|
|
|
216 |
" solid "+(self.options.lensBorderColour)+";background-repeat: no-repeat;position: absolute;";
|
|
|
217 |
}
|
|
|
218 |
|
|
|
219 |
|
|
|
220 |
//tint style
|
|
|
221 |
self.tintStyle = "display: block;"
|
|
|
222 |
+ "position: absolute;"
|
|
|
223 |
+ "background-color: "+self.options.tintColour+";"
|
|
|
224 |
+ "filter:alpha(opacity=0);"
|
|
|
225 |
+ "opacity: 0;"
|
|
|
226 |
+ "width: " + self.nzWidth + "px;"
|
|
|
227 |
+ "height: " + self.nzHeight + "px;"
|
|
|
228 |
|
|
|
229 |
;
|
|
|
230 |
|
|
|
231 |
//lens style for lens zoom with optional round for modern browsers
|
|
|
232 |
self.lensRound = '';
|
|
|
233 |
|
|
|
234 |
if(self.options.zoomType == "lens") {
|
|
|
235 |
|
|
|
236 |
self.lensStyle = "background-position: 0px 0px;"
|
|
|
237 |
+ "float: left;display: none;"
|
|
|
238 |
+ "border: " + String(self.options.borderSize) + "px solid " + self.options.borderColour+";"
|
|
|
239 |
+ "width:"+ String(self.options.lensSize) +"px;"
|
|
|
240 |
+ "height:"+ String(self.options.lensSize)+"px;"
|
|
|
241 |
+ "background-repeat: no-repeat;position: absolute;";
|
|
|
242 |
|
|
|
243 |
|
|
|
244 |
}
|
|
|
245 |
|
|
|
246 |
|
|
|
247 |
//does not round in all browsers
|
|
|
248 |
if(self.options.lensShape == "round") {
|
|
|
249 |
self.lensRound = "border-top-left-radius: " + String(self.options.lensSize / 2 + self.options.borderSize) + "px;"
|
|
|
250 |
+ "border-top-right-radius: " + String(self.options.lensSize / 2 + self.options.borderSize) + "px;"
|
|
|
251 |
+ "border-bottom-left-radius: " + String(self.options.lensSize / 2 + self.options.borderSize) + "px;"
|
|
|
252 |
+ "border-bottom-right-radius: " + String(self.options.lensSize / 2 + self.options.borderSize) + "px;";
|
|
|
253 |
|
|
|
254 |
}
|
|
|
255 |
|
|
|
256 |
//create the div's + ""
|
|
|
257 |
//self.zoomContainer = $('<div/>').addClass('zoomContainer').css({"position":"relative", "height":self.nzHeight, "width":self.nzWidth});
|
|
|
258 |
|
|
|
259 |
self.zoomContainer = $('<div class="zoomContainer" style="-webkit-transform: translateZ(0);position:absolute;left:'+self.nzOffset.left+'px;top:'+self.nzOffset.top+'px;height:'+self.nzHeight+'px;width:'+self.nzWidth+'px;"></div>');
|
|
|
260 |
$('body').append(self.zoomContainer);
|
|
|
261 |
|
|
|
262 |
|
|
|
263 |
//this will add overflow hidden and contrain the lens on lens mode
|
|
|
264 |
if(self.options.containLensZoom && self.options.zoomType == "lens"){
|
|
|
265 |
self.zoomContainer.css("overflow", "hidden");
|
|
|
266 |
}
|
|
|
267 |
if(self.options.zoomType != "inner") {
|
|
|
268 |
self.zoomLens = $("<div class='zoomLens' style='" + self.lensStyle + self.lensRound +"'> </div>")
|
|
|
269 |
.appendTo(self.zoomContainer)
|
|
|
270 |
.click(function () {
|
|
|
271 |
self.$elem.trigger('click');
|
|
|
272 |
});
|
|
|
273 |
|
|
|
274 |
|
|
|
275 |
if(self.options.tint) {
|
|
|
276 |
self.tintContainer = $('<div/>').addClass('tintContainer');
|
|
|
277 |
self.zoomTint = $("<div class='zoomTint' style='"+self.tintStyle+"'></div>");
|
|
|
278 |
|
|
|
279 |
|
|
|
280 |
self.zoomLens.wrap(self.tintContainer);
|
|
|
281 |
|
|
|
282 |
|
|
|
283 |
self.zoomTintcss = self.zoomLens.after(self.zoomTint);
|
|
|
284 |
|
|
|
285 |
//if tint enabled - set an image to show over the tint
|
|
|
286 |
|
|
|
287 |
self.zoomTintImage = $('<img style="position: absolute; left: 0px; top: 0px; max-width: none; width: '+self.nzWidth+'px; height: '+self.nzHeight+'px;" src="'+self.imageSrc+'">')
|
|
|
288 |
.appendTo(self.zoomLens)
|
|
|
289 |
.click(function () {
|
|
|
290 |
|
|
|
291 |
self.$elem.trigger('click');
|
|
|
292 |
});
|
|
|
293 |
|
|
|
294 |
}
|
|
|
295 |
|
|
|
296 |
}
|
|
|
297 |
|
|
|
298 |
|
|
|
299 |
|
|
|
300 |
|
|
|
301 |
|
|
|
302 |
|
|
|
303 |
|
|
|
304 |
//create zoom window
|
|
|
305 |
if(isNaN(self.options.zoomWindowPosition)){
|
|
|
306 |
self.zoomWindow = $("<div style='z-index:999;left:"+(self.windowOffsetLeft)+"px;top:"+(self.windowOffsetTop)+"px;" + self.zoomWindowStyle + "' class='zoomWindow'> </div>")
|
|
|
307 |
.appendTo('body')
|
|
|
308 |
.click(function () {
|
|
|
309 |
self.$elem.trigger('click');
|
|
|
310 |
});
|
|
|
311 |
}else{
|
|
|
312 |
self.zoomWindow = $("<div style='z-index:999;left:"+(self.windowOffsetLeft)+"px;top:"+(self.windowOffsetTop)+"px;" + self.zoomWindowStyle + "' class='zoomWindow'> </div>")
|
|
|
313 |
.appendTo(self.zoomContainer)
|
|
|
314 |
.click(function () {
|
|
|
315 |
self.$elem.trigger('click');
|
|
|
316 |
});
|
|
|
317 |
}
|
|
|
318 |
self.zoomWindowContainer = $('<div/>').addClass('zoomWindowContainer').css("width",self.options.zoomWindowWidth);
|
|
|
319 |
self.zoomWindow.wrap(self.zoomWindowContainer);
|
|
|
320 |
|
|
|
321 |
|
|
|
322 |
// self.captionStyle = "text-align: left;background-color: black;color: white;font-weight: bold;padding: 10px;font-family: sans-serif;font-size: 11px";
|
|
|
323 |
// self.zoomCaption = $('<div class="elevatezoom-caption" style="'+self.captionStyle+'display: block; width: 280px;">INSERT ALT TAG</div>').appendTo(self.zoomWindow.parent());
|
|
|
324 |
|
|
|
325 |
if(self.options.zoomType == "lens") {
|
|
|
326 |
self.zoomLens.css({ backgroundImage: "url('" + self.imageSrc + "')" });
|
|
|
327 |
}
|
|
|
328 |
if(self.options.zoomType == "window") {
|
|
|
329 |
self.zoomWindow.css({ backgroundImage: "url('" + self.imageSrc + "')" });
|
|
|
330 |
}
|
|
|
331 |
if(self.options.zoomType == "inner") {
|
|
|
332 |
self.zoomWindow.css({ backgroundImage: "url('" + self.imageSrc + "')" });
|
|
|
333 |
}
|
|
|
334 |
/*-------------------END THE ZOOM WINDOW AND LENS----------------------------------*/
|
|
|
335 |
//touch events
|
|
|
336 |
self.$elem.bind('touchmove', function(e){
|
|
|
337 |
e.preventDefault();
|
|
|
338 |
var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
|
|
|
339 |
self.setPosition(touch);
|
|
|
340 |
|
|
|
341 |
});
|
|
|
342 |
self.zoomContainer.bind('touchmove', function(e){
|
|
|
343 |
if(self.options.zoomType == "inner") {
|
|
|
344 |
self.showHideWindow("show");
|
|
|
345 |
|
|
|
346 |
}
|
|
|
347 |
e.preventDefault();
|
|
|
348 |
var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
|
|
|
349 |
self.setPosition(touch);
|
|
|
350 |
|
|
|
351 |
});
|
|
|
352 |
self.zoomContainer.bind('touchend', function(e){
|
|
|
353 |
self.showHideWindow("hide");
|
|
|
354 |
if(self.options.showLens) {self.showHideLens("hide");}
|
|
|
355 |
if(self.options.tint && self.options.zoomType != "inner") {self.showHideTint("hide");}
|
|
|
356 |
});
|
|
|
357 |
|
|
|
358 |
self.$elem.bind('touchend', function(e){
|
|
|
359 |
self.showHideWindow("hide");
|
|
|
360 |
if(self.options.showLens) {self.showHideLens("hide");}
|
|
|
361 |
if(self.options.tint && self.options.zoomType != "inner") {self.showHideTint("hide");}
|
|
|
362 |
});
|
|
|
363 |
if(self.options.showLens) {
|
|
|
364 |
self.zoomLens.bind('touchmove', function(e){
|
|
|
365 |
|
|
|
366 |
e.preventDefault();
|
|
|
367 |
var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
|
|
|
368 |
self.setPosition(touch);
|
|
|
369 |
});
|
|
|
370 |
|
|
|
371 |
|
|
|
372 |
self.zoomLens.bind('touchend', function(e){
|
|
|
373 |
self.showHideWindow("hide");
|
|
|
374 |
if(self.options.showLens) {self.showHideLens("hide");}
|
|
|
375 |
if(self.options.tint && self.options.zoomType != "inner") {self.showHideTint("hide");}
|
|
|
376 |
});
|
|
|
377 |
}
|
|
|
378 |
//Needed to work in IE
|
|
|
379 |
self.$elem.bind('mousemove', function(e){
|
|
|
380 |
if(self.overWindow == false){self.setElements("show");}
|
|
|
381 |
//make sure on orientation change the setposition is not fired
|
|
|
382 |
if(self.lastX !== e.clientX || self.lastY !== e.clientY){
|
|
|
383 |
self.setPosition(e);
|
|
|
384 |
self.currentLoc = e;
|
|
|
385 |
}
|
|
|
386 |
self.lastX = e.clientX;
|
|
|
387 |
self.lastY = e.clientY;
|
|
|
388 |
|
|
|
389 |
});
|
|
|
390 |
|
|
|
391 |
self.zoomContainer.bind('mousemove', function(e){
|
|
|
392 |
|
|
|
393 |
if(self.overWindow == false){self.setElements("show");}
|
|
|
394 |
|
|
|
395 |
//make sure on orientation change the setposition is not fired
|
|
|
396 |
if(self.lastX !== e.clientX || self.lastY !== e.clientY){
|
|
|
397 |
self.setPosition(e);
|
|
|
398 |
self.currentLoc = e;
|
|
|
399 |
}
|
|
|
400 |
self.lastX = e.clientX;
|
|
|
401 |
self.lastY = e.clientY;
|
|
|
402 |
});
|
|
|
403 |
if(self.options.zoomType != "inner") {
|
|
|
404 |
self.zoomLens.bind('mousemove', function(e){
|
|
|
405 |
//make sure on orientation change the setposition is not fired
|
|
|
406 |
if(self.lastX !== e.clientX || self.lastY !== e.clientY){
|
|
|
407 |
self.setPosition(e);
|
|
|
408 |
self.currentLoc = e;
|
|
|
409 |
}
|
|
|
410 |
self.lastX = e.clientX;
|
|
|
411 |
self.lastY = e.clientY;
|
|
|
412 |
});
|
|
|
413 |
}
|
|
|
414 |
if(self.options.tint && self.options.zoomType != "inner") {
|
|
|
415 |
self.zoomTint.bind('mousemove', function(e){
|
|
|
416 |
//make sure on orientation change the setposition is not fired
|
|
|
417 |
if(self.lastX !== e.clientX || self.lastY !== e.clientY){
|
|
|
418 |
self.setPosition(e);
|
|
|
419 |
self.currentLoc = e;
|
|
|
420 |
}
|
|
|
421 |
self.lastX = e.clientX;
|
|
|
422 |
self.lastY = e.clientY;
|
|
|
423 |
});
|
|
|
424 |
|
|
|
425 |
}
|
|
|
426 |
if(self.options.zoomType == "inner") {
|
|
|
427 |
self.zoomWindow.bind('mousemove', function(e) {
|
|
|
428 |
//self.overWindow = true;
|
|
|
429 |
//make sure on orientation change the setposition is not fired
|
|
|
430 |
if(self.lastX !== e.clientX || self.lastY !== e.clientY){
|
|
|
431 |
self.setPosition(e);
|
|
|
432 |
self.currentLoc = e;
|
|
|
433 |
}
|
|
|
434 |
self.lastX = e.clientX;
|
|
|
435 |
self.lastY = e.clientY;
|
|
|
436 |
});
|
|
|
437 |
|
|
|
438 |
}
|
|
|
439 |
|
|
|
440 |
|
|
|
441 |
// lensFadeOut: 500, zoomTintFadeIn
|
|
|
442 |
self.zoomContainer.add(self.$elem).mouseenter(function(){
|
|
|
443 |
|
|
|
444 |
if(self.overWindow == false){self.setElements("show");}
|
|
|
445 |
|
|
|
446 |
|
|
|
447 |
}).mouseleave(function(){
|
|
|
448 |
if(!self.scrollLock){
|
|
|
449 |
self.setElements("hide");
|
|
|
450 |
}
|
|
|
451 |
});
|
|
|
452 |
//end ove image
|
|
|
453 |
|
|
|
454 |
|
|
|
455 |
|
|
|
456 |
|
|
|
457 |
|
|
|
458 |
if(self.options.zoomType != "inner") {
|
|
|
459 |
self.zoomWindow.mouseenter(function(){
|
|
|
460 |
self.overWindow = true;
|
|
|
461 |
self.setElements("hide");
|
|
|
462 |
}).mouseleave(function(){
|
|
|
463 |
|
|
|
464 |
self.overWindow = false;
|
|
|
465 |
});
|
|
|
466 |
}
|
|
|
467 |
//end ove image
|
|
|
468 |
|
|
|
469 |
|
|
|
470 |
|
|
|
471 |
// var delta = parseInt(e.originalEvent.wheelDelta || -e.originalEvent.detail);
|
|
|
472 |
|
|
|
473 |
// $(this).empty();
|
|
|
474 |
// return false;
|
|
|
475 |
|
|
|
476 |
//fix for initial zoom setting
|
|
|
477 |
if (self.options.zoomLevel != 1){
|
|
|
478 |
// self.changeZoomLevel(self.currentZoomLevel);
|
|
|
479 |
}
|
|
|
480 |
//set the min zoomlevel
|
|
|
481 |
if(self.options.minZoomLevel){
|
|
|
482 |
self.minZoomLevel = self.options.minZoomLevel;
|
|
|
483 |
}
|
|
|
484 |
else{
|
|
|
485 |
self.minZoomLevel = self.options.scrollZoomIncrement * 2;
|
|
|
486 |
}
|
|
|
487 |
|
|
|
488 |
|
|
|
489 |
if(self.options.scrollZoom){
|
|
|
490 |
|
|
|
491 |
|
|
|
492 |
self.zoomContainer.add(self.$elem).bind('mousewheel DOMMouseScroll MozMousePixelScroll', function(e){
|
|
|
493 |
|
|
|
494 |
|
|
|
495 |
// in IE there is issue with firing of mouseleave - So check whether still scrolling
|
|
|
496 |
// and on mouseleave check if scrolllock
|
|
|
497 |
self.scrollLock = true;
|
|
|
498 |
clearTimeout($.data(this, 'timer'));
|
|
|
499 |
$.data(this, 'timer', setTimeout(function() {
|
|
|
500 |
self.scrollLock = false;
|
|
|
501 |
//do something
|
|
|
502 |
}, 250));
|
|
|
503 |
|
|
|
504 |
var theEvent = e.originalEvent.wheelDelta || e.originalEvent.detail*-1
|
|
|
505 |
|
|
|
506 |
|
|
|
507 |
//this.scrollTop += ( delta < 0 ? 1 : -1 ) * 30;
|
|
|
508 |
// e.preventDefault();
|
|
|
509 |
|
|
|
510 |
|
|
|
511 |
e.stopImmediatePropagation();
|
|
|
512 |
e.stopPropagation();
|
|
|
513 |
e.preventDefault();
|
|
|
514 |
|
|
|
515 |
|
|
|
516 |
if(theEvent /120 > 0) {
|
|
|
517 |
//scrolling up
|
|
|
518 |
if(self.currentZoomLevel >= self.minZoomLevel){
|
|
|
519 |
self.changeZoomLevel(self.currentZoomLevel-self.options.scrollZoomIncrement);
|
|
|
520 |
}
|
|
|
521 |
|
|
|
522 |
}
|
|
|
523 |
else{
|
|
|
524 |
//scrolling down
|
|
|
525 |
|
|
|
526 |
|
|
|
527 |
if(self.options.maxZoomLevel){
|
|
|
528 |
if(self.currentZoomLevel <= self.options.maxZoomLevel){
|
|
|
529 |
self.changeZoomLevel(parseFloat(self.currentZoomLevel)+self.options.scrollZoomIncrement);
|
|
|
530 |
}
|
|
|
531 |
}
|
|
|
532 |
else{
|
|
|
533 |
//andy
|
|
|
534 |
|
|
|
535 |
self.changeZoomLevel(parseFloat(self.currentZoomLevel)+self.options.scrollZoomIncrement);
|
|
|
536 |
}
|
|
|
537 |
|
|
|
538 |
}
|
|
|
539 |
return false;
|
|
|
540 |
});
|
|
|
541 |
}
|
|
|
542 |
|
|
|
543 |
|
|
|
544 |
},
|
|
|
545 |
setElements: function(type) {
|
|
|
546 |
var self = this;
|
|
|
547 |
if(!self.options.zoomEnabled){return false;}
|
|
|
548 |
if(type=="show"){
|
|
|
549 |
if(self.isWindowSet){
|
|
|
550 |
if(self.options.zoomType == "inner") {self.showHideWindow("show");}
|
|
|
551 |
if(self.options.zoomType == "window") {self.showHideWindow("show");}
|
|
|
552 |
if(self.options.showLens) {self.showHideLens("show");}
|
|
|
553 |
if(self.options.tint && self.options.zoomType != "inner") {self.showHideTint("show");
|
|
|
554 |
}
|
|
|
555 |
}
|
|
|
556 |
}
|
|
|
557 |
|
|
|
558 |
if(type=="hide"){
|
|
|
559 |
if(self.options.zoomType == "window") {self.showHideWindow("hide");}
|
|
|
560 |
if(!self.options.tint) {self.showHideWindow("hide");}
|
|
|
561 |
if(self.options.showLens) {self.showHideLens("hide");}
|
|
|
562 |
if(self.options.tint) { self.showHideTint("hide");}
|
|
|
563 |
}
|
|
|
564 |
},
|
|
|
565 |
setPosition: function(e) {
|
|
|
566 |
|
|
|
567 |
var self = this;
|
|
|
568 |
|
|
|
569 |
if(!self.options.zoomEnabled){return false;}
|
|
|
570 |
|
|
|
571 |
//recaclc offset each time in case the image moves
|
|
|
572 |
//this can be caused by other on page elements
|
|
|
573 |
self.nzHeight = self.$elem.height();
|
|
|
574 |
self.nzWidth = self.$elem.width();
|
|
|
575 |
self.nzOffset = self.$elem.offset();
|
|
|
576 |
|
|
|
577 |
if(self.options.tint && self.options.zoomType != "inner") {
|
|
|
578 |
self.zoomTint.css({ top: 0});
|
|
|
579 |
self.zoomTint.css({ left: 0});
|
|
|
580 |
}
|
|
|
581 |
//set responsive
|
|
|
582 |
//will checking if the image needs changing before running this code work faster?
|
|
|
583 |
if(self.options.responsive && !self.options.scrollZoom){
|
|
|
584 |
if(self.options.showLens){
|
|
|
585 |
if(self.nzHeight < self.options.zoomWindowWidth/self.widthRatio){
|
|
|
586 |
lensHeight = self.nzHeight;
|
|
|
587 |
}
|
|
|
588 |
else{
|
|
|
589 |
lensHeight = String((self.options.zoomWindowHeight/self.heightRatio))
|
|
|
590 |
}
|
|
|
591 |
if(self.largeWidth < self.options.zoomWindowWidth){
|
|
|
592 |
lensWidth = self.nzWidth;
|
|
|
593 |
}
|
|
|
594 |
else{
|
|
|
595 |
lensWidth = (self.options.zoomWindowWidth/self.widthRatio);
|
|
|
596 |
}
|
|
|
597 |
self.widthRatio = self.largeWidth / self.nzWidth;
|
|
|
598 |
self.heightRatio = self.largeHeight / self.nzHeight;
|
|
|
599 |
if(self.options.zoomType != "lens") {
|
|
|
600 |
|
|
|
601 |
|
|
|
602 |
//possibly dont need to keep recalcalculating
|
|
|
603 |
//if the lens is heigher than the image, then set lens size to image size
|
|
|
604 |
if(self.nzHeight < self.options.zoomWindowWidth/self.widthRatio){
|
|
|
605 |
lensHeight = self.nzHeight;
|
|
|
606 |
|
|
|
607 |
}
|
|
|
608 |
else{
|
|
|
609 |
lensHeight = String((self.options.zoomWindowHeight/self.heightRatio))
|
|
|
610 |
}
|
|
|
611 |
|
|
|
612 |
if(self.options.zoomWindowWidth < self.options.zoomWindowWidth){
|
|
|
613 |
lensWidth = self.nzWidth;
|
|
|
614 |
}
|
|
|
615 |
else{
|
|
|
616 |
lensWidth = (self.options.zoomWindowWidth/self.widthRatio);
|
|
|
617 |
}
|
|
|
618 |
|
|
|
619 |
self.zoomLens.css('width', lensWidth);
|
|
|
620 |
self.zoomLens.css('height', lensHeight);
|
|
|
621 |
|
|
|
622 |
if(self.options.tint){
|
|
|
623 |
self.zoomTintImage.css('width', self.nzWidth);
|
|
|
624 |
self.zoomTintImage.css('height', self.nzHeight);
|
|
|
625 |
}
|
|
|
626 |
|
|
|
627 |
}
|
|
|
628 |
if(self.options.zoomType == "lens") {
|
|
|
629 |
|
|
|
630 |
self.zoomLens.css({ width: String(self.options.lensSize) + 'px', height: String(self.options.lensSize) + 'px' })
|
|
|
631 |
|
|
|
632 |
|
|
|
633 |
}
|
|
|
634 |
//end responsive image change
|
|
|
635 |
}
|
|
|
636 |
}
|
|
|
637 |
|
|
|
638 |
//container fix
|
|
|
639 |
self.zoomContainer.css({ top: self.nzOffset.top});
|
|
|
640 |
self.zoomContainer.css({ left: self.nzOffset.left});
|
|
|
641 |
self.mouseLeft = parseInt(e.pageX - self.nzOffset.left);
|
|
|
642 |
self.mouseTop = parseInt(e.pageY - self.nzOffset.top);
|
|
|
643 |
//calculate the Location of the Lens
|
|
|
644 |
|
|
|
645 |
//calculate the bound regions - but only if zoom window
|
|
|
646 |
if(self.options.zoomType == "window") {
|
|
|
647 |
self.Etoppos = (self.mouseTop < (self.zoomLens.height()/2));
|
|
|
648 |
self.Eboppos = (self.mouseTop > self.nzHeight - (self.zoomLens.height()/2)-(self.options.lensBorderSize*2));
|
|
|
649 |
self.Eloppos = (self.mouseLeft < 0+((self.zoomLens.width()/2)));
|
|
|
650 |
self.Eroppos = (self.mouseLeft > (self.nzWidth - (self.zoomLens.width()/2)-(self.options.lensBorderSize*2)));
|
|
|
651 |
}
|
|
|
652 |
//calculate the bound regions - but only for inner zoom
|
|
|
653 |
if(self.options.zoomType == "inner"){
|
|
|
654 |
self.Etoppos = (self.mouseTop < ((self.nzHeight/2)/self.heightRatio) );
|
|
|
655 |
self.Eboppos = (self.mouseTop > (self.nzHeight - ((self.nzHeight/2)/self.heightRatio)));
|
|
|
656 |
self.Eloppos = (self.mouseLeft < 0+(((self.nzWidth/2)/self.widthRatio)));
|
|
|
657 |
self.Eroppos = (self.mouseLeft > (self.nzWidth - (self.nzWidth/2)/self.widthRatio-(self.options.lensBorderSize*2)));
|
|
|
658 |
}
|
|
|
659 |
|
|
|
660 |
// if the mouse position of the slider is one of the outerbounds, then hide window and lens
|
|
|
661 |
if (self.mouseLeft <= 0 || self.mouseTop < 0 || self.mouseLeft > self.nzWidth || self.mouseTop > self.nzHeight ) {
|
|
|
662 |
self.setElements("hide");
|
|
|
663 |
return;
|
|
|
664 |
}
|
|
|
665 |
//else continue with operations
|
|
|
666 |
else {
|
|
|
667 |
|
|
|
668 |
|
|
|
669 |
//lens options
|
|
|
670 |
if(self.options.showLens) {
|
|
|
671 |
// self.showHideLens("show");
|
|
|
672 |
//set background position of lens
|
|
|
673 |
self.lensLeftPos = String(self.mouseLeft - self.zoomLens.width() / 2);
|
|
|
674 |
self.lensTopPos = String(self.mouseTop - self.zoomLens.height() / 2);
|
|
|
675 |
|
|
|
676 |
|
|
|
677 |
}
|
|
|
678 |
//adjust the background position if the mouse is in one of the outer regions
|
|
|
679 |
|
|
|
680 |
//Top region
|
|
|
681 |
if(self.Etoppos){
|
|
|
682 |
self.lensTopPos = 0;
|
|
|
683 |
}
|
|
|
684 |
//Left Region
|
|
|
685 |
if(self.Eloppos){
|
|
|
686 |
self.windowLeftPos = 0;
|
|
|
687 |
self.lensLeftPos = 0;
|
|
|
688 |
self.tintpos=0;
|
|
|
689 |
}
|
|
|
690 |
//Set bottom and right region for window mode
|
|
|
691 |
if(self.options.zoomType == "window") {
|
|
|
692 |
if(self.Eboppos){
|
|
|
693 |
self.lensTopPos = Math.max( (self.nzHeight)-self.zoomLens.height()-(self.options.lensBorderSize*2), 0 );
|
|
|
694 |
}
|
|
|
695 |
if(self.Eroppos){
|
|
|
696 |
self.lensLeftPos = (self.nzWidth-(self.zoomLens.width())-(self.options.lensBorderSize*2));
|
|
|
697 |
}
|
|
|
698 |
}
|
|
|
699 |
//Set bottom and right region for inner mode
|
|
|
700 |
if(self.options.zoomType == "inner") {
|
|
|
701 |
if(self.Eboppos){
|
|
|
702 |
self.lensTopPos = Math.max( ((self.nzHeight)-(self.options.lensBorderSize*2)), 0 );
|
|
|
703 |
}
|
|
|
704 |
if(self.Eroppos){
|
|
|
705 |
self.lensLeftPos = (self.nzWidth-(self.nzWidth)-(self.options.lensBorderSize*2));
|
|
|
706 |
}
|
|
|
707 |
|
|
|
708 |
}
|
|
|
709 |
//if lens zoom
|
|
|
710 |
if(self.options.zoomType == "lens") {
|
|
|
711 |
self.windowLeftPos = String(((e.pageX - self.nzOffset.left) * self.widthRatio - self.zoomLens.width() / 2) * (-1));
|
|
|
712 |
self.windowTopPos = String(((e.pageY - self.nzOffset.top) * self.heightRatio - self.zoomLens.height() / 2) * (-1));
|
|
|
713 |
|
|
|
714 |
self.zoomLens.css({ backgroundPosition: self.windowLeftPos + 'px ' + self.windowTopPos + 'px' });
|
|
|
715 |
|
|
|
716 |
if(self.changeBgSize){
|
|
|
717 |
|
|
|
718 |
if(self.nzHeight>self.nzWidth){
|
|
|
719 |
if(self.options.zoomType == "lens"){
|
|
|
720 |
self.zoomLens.css({ "background-size": self.largeWidth/self.newvalueheight + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
|
|
|
721 |
}
|
|
|
722 |
|
|
|
723 |
self.zoomWindow.css({ "background-size": self.largeWidth/self.newvalueheight + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
|
|
|
724 |
}
|
|
|
725 |
else{
|
|
|
726 |
if(self.options.zoomType == "lens"){
|
|
|
727 |
self.zoomLens.css({ "background-size": self.largeWidth/self.newvaluewidth + 'px ' + self.largeHeight/self.newvaluewidth + 'px' });
|
|
|
728 |
}
|
|
|
729 |
self.zoomWindow.css({ "background-size": self.largeWidth/self.newvaluewidth + 'px ' + self.largeHeight/self.newvaluewidth + 'px' });
|
|
|
730 |
}
|
|
|
731 |
self.changeBgSize = false;
|
|
|
732 |
}
|
|
|
733 |
|
|
|
734 |
self.setWindowPostition(e);
|
|
|
735 |
}
|
|
|
736 |
//if tint zoom
|
|
|
737 |
if(self.options.tint && self.options.zoomType != "inner") {
|
|
|
738 |
self.setTintPosition(e);
|
|
|
739 |
|
|
|
740 |
}
|
|
|
741 |
//set the css background position
|
|
|
742 |
if(self.options.zoomType == "window") {
|
|
|
743 |
self.setWindowPostition(e);
|
|
|
744 |
}
|
|
|
745 |
if(self.options.zoomType == "inner") {
|
|
|
746 |
self.setWindowPostition(e);
|
|
|
747 |
}
|
|
|
748 |
if(self.options.showLens) {
|
|
|
749 |
|
|
|
750 |
if(self.fullwidth && self.options.zoomType != "lens"){
|
|
|
751 |
self.lensLeftPos = 0;
|
|
|
752 |
|
|
|
753 |
}
|
|
|
754 |
self.zoomLens.css({ left: self.lensLeftPos + 'px', top: self.lensTopPos + 'px' })
|
|
|
755 |
}
|
|
|
756 |
|
|
|
757 |
} //end else
|
|
|
758 |
|
|
|
759 |
|
|
|
760 |
|
|
|
761 |
},
|
|
|
762 |
showHideWindow: function(change) {
|
|
|
763 |
var self = this;
|
|
|
764 |
if(change == "show"){
|
|
|
765 |
if(!self.isWindowActive){
|
|
|
766 |
if(self.options.zoomWindowFadeIn){
|
|
|
767 |
self.zoomWindow.stop(true, true, false).fadeIn(self.options.zoomWindowFadeIn);
|
|
|
768 |
}
|
|
|
769 |
else{self.zoomWindow.show();}
|
|
|
770 |
self.isWindowActive = true;
|
|
|
771 |
}
|
|
|
772 |
}
|
|
|
773 |
if(change == "hide"){
|
|
|
774 |
if(self.isWindowActive){
|
|
|
775 |
if(self.options.zoomWindowFadeOut){
|
|
|
776 |
self.zoomWindow.stop(true, true).fadeOut(self.options.zoomWindowFadeOut);
|
|
|
777 |
}
|
|
|
778 |
else{self.zoomWindow.hide();}
|
|
|
779 |
self.isWindowActive = false;
|
|
|
780 |
}
|
|
|
781 |
}
|
|
|
782 |
},
|
|
|
783 |
showHideLens: function(change) {
|
|
|
784 |
var self = this;
|
|
|
785 |
if(change == "show"){
|
|
|
786 |
if(!self.isLensActive){
|
|
|
787 |
if(self.options.lensFadeIn){
|
|
|
788 |
self.zoomLens.stop(true, true, false).fadeIn(self.options.lensFadeIn);
|
|
|
789 |
}
|
|
|
790 |
else{self.zoomLens.show();}
|
|
|
791 |
self.isLensActive = true;
|
|
|
792 |
}
|
|
|
793 |
}
|
|
|
794 |
if(change == "hide"){
|
|
|
795 |
if(self.isLensActive){
|
|
|
796 |
if(self.options.lensFadeOut){
|
|
|
797 |
self.zoomLens.stop(true, true).fadeOut(self.options.lensFadeOut);
|
|
|
798 |
}
|
|
|
799 |
else{self.zoomLens.hide();}
|
|
|
800 |
self.isLensActive = false;
|
|
|
801 |
}
|
|
|
802 |
}
|
|
|
803 |
},
|
|
|
804 |
showHideTint: function(change) {
|
|
|
805 |
var self = this;
|
|
|
806 |
if(change == "show"){
|
|
|
807 |
if(!self.isTintActive){
|
|
|
808 |
|
|
|
809 |
if(self.options.zoomTintFadeIn){
|
|
|
810 |
self.zoomTint.css({opacity:self.options.tintOpacity}).animate().stop(true, true).fadeIn("slow");
|
|
|
811 |
}
|
|
|
812 |
else{
|
|
|
813 |
self.zoomTint.css({opacity:self.options.tintOpacity}).animate();
|
|
|
814 |
self.zoomTint.show();
|
|
|
815 |
|
|
|
816 |
|
|
|
817 |
}
|
|
|
818 |
self.isTintActive = true;
|
|
|
819 |
}
|
|
|
820 |
}
|
|
|
821 |
if(change == "hide"){
|
|
|
822 |
if(self.isTintActive){
|
|
|
823 |
|
|
|
824 |
if(self.options.zoomTintFadeOut){
|
|
|
825 |
self.zoomTint.stop(true, true).fadeOut(self.options.zoomTintFadeOut);
|
|
|
826 |
}
|
|
|
827 |
else{self.zoomTint.hide();}
|
|
|
828 |
self.isTintActive = false;
|
|
|
829 |
}
|
|
|
830 |
}
|
|
|
831 |
},
|
|
|
832 |
setLensPostition: function( e ) {
|
|
|
833 |
|
|
|
834 |
|
|
|
835 |
},
|
|
|
836 |
setWindowPostition: function( e ) {
|
|
|
837 |
//return obj.slice( 0, count );
|
|
|
838 |
var self = this;
|
|
|
839 |
|
|
|
840 |
if(!isNaN(self.options.zoomWindowPosition)){
|
|
|
841 |
|
|
|
842 |
switch (self.options.zoomWindowPosition) {
|
|
|
843 |
case 1: //done
|
|
|
844 |
self.windowOffsetTop = (self.options.zoomWindowOffety);//DONE - 1
|
|
|
845 |
self.windowOffsetLeft =(+self.nzWidth); //DONE 1, 2, 3, 4, 16
|
|
|
846 |
break;
|
|
|
847 |
case 2:
|
|
|
848 |
if(self.options.zoomWindowHeight > self.nzHeight){ //positive margin
|
|
|
849 |
|
|
|
850 |
self.windowOffsetTop = ((self.options.zoomWindowHeight/2)-(self.nzHeight/2))*(-1);
|
|
|
851 |
self.windowOffsetLeft =(self.nzWidth); //DONE 1, 2, 3, 4, 16
|
|
|
852 |
}
|
|
|
853 |
else{ //negative margin
|
|
|
854 |
|
|
|
855 |
}
|
|
|
856 |
break;
|
|
|
857 |
case 3: //done
|
|
|
858 |
self.windowOffsetTop = (self.nzHeight - self.zoomWindow.height() - (self.options.borderSize*2)); //DONE 3,9
|
|
|
859 |
self.windowOffsetLeft =(self.nzWidth); //DONE 1, 2, 3, 4, 16
|
|
|
860 |
break;
|
|
|
861 |
case 4: //done
|
|
|
862 |
self.windowOffsetTop = (self.nzHeight); //DONE - 4,5,6,7,8
|
|
|
863 |
self.windowOffsetLeft =(self.nzWidth); //DONE 1, 2, 3, 4, 16
|
|
|
864 |
break;
|
|
|
865 |
case 5: //done
|
|
|
866 |
self.windowOffsetTop = (self.nzHeight); //DONE - 4,5,6,7,8
|
|
|
867 |
self.windowOffsetLeft =(self.nzWidth-self.zoomWindow.width()-(self.options.borderSize*2)); //DONE - 5,15
|
|
|
868 |
break;
|
|
|
869 |
case 6:
|
|
|
870 |
if(self.options.zoomWindowHeight > self.nzHeight){ //positive margin
|
|
|
871 |
self.windowOffsetTop = (self.nzHeight); //DONE - 4,5,6,7,8
|
|
|
872 |
|
|
|
873 |
self.windowOffsetLeft =((self.options.zoomWindowWidth/2)-(self.nzWidth/2)+(self.options.borderSize*2))*(-1);
|
|
|
874 |
}
|
|
|
875 |
else{ //negative margin
|
|
|
876 |
|
|
|
877 |
}
|
|
|
878 |
|
|
|
879 |
|
|
|
880 |
break;
|
|
|
881 |
case 7: //done
|
|
|
882 |
self.windowOffsetTop = (self.nzHeight); //DONE - 4,5,6,7,8
|
|
|
883 |
self.windowOffsetLeft = 0; //DONE 7, 13
|
|
|
884 |
break;
|
|
|
885 |
case 8: //done
|
|
|
886 |
self.windowOffsetTop = (self.nzHeight); //DONE - 4,5,6,7,8
|
|
|
887 |
self.windowOffsetLeft =(self.zoomWindow.width()+(self.options.borderSize*2) )* (-1); //DONE 8,9,10,11,12
|
|
|
888 |
break;
|
|
|
889 |
case 9: //done
|
|
|
890 |
self.windowOffsetTop = (self.nzHeight - self.zoomWindow.height() - (self.options.borderSize*2)); //DONE 3,9
|
|
|
891 |
self.windowOffsetLeft =(self.zoomWindow.width()+(self.options.borderSize*2) )* (-1); //DONE 8,9,10,11,12
|
|
|
892 |
break;
|
|
|
893 |
case 10:
|
|
|
894 |
if(self.options.zoomWindowHeight > self.nzHeight){ //positive margin
|
|
|
895 |
|
|
|
896 |
self.windowOffsetTop = ((self.options.zoomWindowHeight/2)-(self.nzHeight/2))*(-1);
|
|
|
897 |
self.windowOffsetLeft =(self.zoomWindow.width()+(self.options.borderSize*2) )* (-1); //DONE 8,9,10,11,12
|
|
|
898 |
}
|
|
|
899 |
else{ //negative margin
|
|
|
900 |
|
|
|
901 |
}
|
|
|
902 |
break;
|
|
|
903 |
case 11:
|
|
|
904 |
self.windowOffsetTop = (self.options.zoomWindowOffety);
|
|
|
905 |
self.windowOffsetLeft =(self.zoomWindow.width()+(self.options.borderSize*2) )* (-1); //DONE 8,9,10,11,12
|
|
|
906 |
break;
|
|
|
907 |
case 12: //done
|
|
|
908 |
self.windowOffsetTop = (self.zoomWindow.height()+(self.options.borderSize*2))*(-1); //DONE 12,13,14,15,16
|
|
|
909 |
self.windowOffsetLeft =(self.zoomWindow.width()+(self.options.borderSize*2) )* (-1); //DONE 8,9,10,11,12
|
|
|
910 |
break;
|
|
|
911 |
case 13: //done
|
|
|
912 |
self.windowOffsetTop = (self.zoomWindow.height()+(self.options.borderSize*2))*(-1); //DONE 12,13,14,15,16
|
|
|
913 |
self.windowOffsetLeft =(0); //DONE 7, 13
|
|
|
914 |
break;
|
|
|
915 |
case 14:
|
|
|
916 |
if(self.options.zoomWindowHeight > self.nzHeight){ //positive margin
|
|
|
917 |
self.windowOffsetTop = (self.zoomWindow.height()+(self.options.borderSize*2))*(-1); //DONE 12,13,14,15,16
|
|
|
918 |
|
|
|
919 |
self.windowOffsetLeft =((self.options.zoomWindowWidth/2)-(self.nzWidth/2)+(self.options.borderSize*2))*(-1);
|
|
|
920 |
}
|
|
|
921 |
else{ //negative margin
|
|
|
922 |
|
|
|
923 |
}
|
|
|
924 |
|
|
|
925 |
break;
|
|
|
926 |
case 15://done
|
|
|
927 |
self.windowOffsetTop = (self.zoomWindow.height()+(self.options.borderSize*2))*(-1); //DONE 12,13,14,15,16
|
|
|
928 |
self.windowOffsetLeft =(self.nzWidth-self.zoomWindow.width()-(self.options.borderSize*2)); //DONE - 5,15
|
|
|
929 |
break;
|
|
|
930 |
case 16: //done
|
|
|
931 |
self.windowOffsetTop = (self.zoomWindow.height()+(self.options.borderSize*2))*(-1); //DONE 12,13,14,15,16
|
|
|
932 |
self.windowOffsetLeft =(self.nzWidth); //DONE 1, 2, 3, 4, 16
|
|
|
933 |
break;
|
|
|
934 |
default: //done
|
|
|
935 |
self.windowOffsetTop = (self.options.zoomWindowOffety);//DONE - 1
|
|
|
936 |
self.windowOffsetLeft =(self.nzWidth); //DONE 1, 2, 3, 4, 16
|
|
|
937 |
}
|
|
|
938 |
} //end isNAN
|
|
|
939 |
else{
|
|
|
940 |
//WE CAN POSITION IN A CLASS - ASSUME THAT ANY STRING PASSED IS
|
|
|
941 |
self.externalContainer = $('#'+self.options.zoomWindowPosition);
|
|
|
942 |
self.externalContainerWidth = self.externalContainer.width();
|
|
|
943 |
self.externalContainerHeight = self.externalContainer.height();
|
|
|
944 |
self.externalContainerOffset = self.externalContainer.offset();
|
|
|
945 |
|
|
|
946 |
self.windowOffsetTop = self.externalContainerOffset.top;//DONE - 1
|
|
|
947 |
self.windowOffsetLeft =self.externalContainerOffset.left; //DONE 1, 2, 3, 4, 16
|
|
|
948 |
|
|
|
949 |
}
|
|
|
950 |
self.isWindowSet = true;
|
|
|
951 |
self.windowOffsetTop = self.windowOffsetTop + self.options.zoomWindowOffety;
|
|
|
952 |
self.windowOffsetLeft = self.windowOffsetLeft + self.options.zoomWindowOffetx;
|
|
|
953 |
|
|
|
954 |
self.zoomWindow.css({ top: self.windowOffsetTop});
|
|
|
955 |
self.zoomWindow.css({ left: self.windowOffsetLeft});
|
|
|
956 |
|
|
|
957 |
if(self.options.zoomType == "inner") {
|
|
|
958 |
self.zoomWindow.css({ top: 0});
|
|
|
959 |
self.zoomWindow.css({ left: 0});
|
|
|
960 |
|
|
|
961 |
}
|
|
|
962 |
|
|
|
963 |
|
|
|
964 |
self.windowLeftPos = String(((e.pageX - self.nzOffset.left) * self.widthRatio - self.zoomWindow.width() / 2) * (-1));
|
|
|
965 |
self.windowTopPos = String(((e.pageY - self.nzOffset.top) * self.heightRatio - self.zoomWindow.height() / 2) * (-1));
|
|
|
966 |
if(self.Etoppos){self.windowTopPos = 0;}
|
|
|
967 |
if(self.Eloppos){self.windowLeftPos = 0;}
|
|
|
968 |
if(self.Eboppos){self.windowTopPos = (self.largeHeight/self.currentZoomLevel-self.zoomWindow.height())*(-1); }
|
|
|
969 |
if(self.Eroppos){self.windowLeftPos = ((self.largeWidth/self.currentZoomLevel-self.zoomWindow.width())*(-1));}
|
|
|
970 |
|
|
|
971 |
//stops micro movements
|
|
|
972 |
if(self.fullheight){
|
|
|
973 |
self.windowTopPos = 0;
|
|
|
974 |
|
|
|
975 |
}
|
|
|
976 |
if(self.fullwidth){
|
|
|
977 |
self.windowLeftPos = 0;
|
|
|
978 |
|
|
|
979 |
}
|
|
|
980 |
//set the css background position
|
|
|
981 |
|
|
|
982 |
|
|
|
983 |
if(self.options.zoomType == "window" || self.options.zoomType == "inner") {
|
|
|
984 |
|
|
|
985 |
if(self.zoomLock == 1){
|
|
|
986 |
//overrides for images not zoomable
|
|
|
987 |
if(self.widthRatio <= 1){
|
|
|
988 |
|
|
|
989 |
self.windowLeftPos = 0;
|
|
|
990 |
}
|
|
|
991 |
if(self.heightRatio <= 1){
|
|
|
992 |
self.windowTopPos = 0;
|
|
|
993 |
}
|
|
|
994 |
}
|
|
|
995 |
// adjust images less than the window height
|
|
|
996 |
|
|
|
997 |
if(self.largeHeight < self.options.zoomWindowHeight){
|
|
|
998 |
|
|
|
999 |
self.windowTopPos = 0;
|
|
|
1000 |
}
|
|
|
1001 |
if(self.largeWidth < self.options.zoomWindowWidth){
|
|
|
1002 |
self.windowLeftPos = 0;
|
|
|
1003 |
}
|
|
|
1004 |
|
|
|
1005 |
//set the zoomwindow background position
|
|
|
1006 |
if (self.options.easing){
|
|
|
1007 |
|
|
|
1008 |
// if(self.changeZoom){
|
|
|
1009 |
// clearInterval(self.loop);
|
|
|
1010 |
// self.changeZoom = false;
|
|
|
1011 |
// self.loop = false;
|
|
|
1012 |
|
|
|
1013 |
// }
|
|
|
1014 |
//set the pos to 0 if not set
|
|
|
1015 |
if(!self.xp){self.xp = 0;}
|
|
|
1016 |
if(!self.yp){self.yp = 0;}
|
|
|
1017 |
//if loop not already started, then run it
|
|
|
1018 |
if (!self.loop){
|
|
|
1019 |
self.loop = setInterval(function(){
|
|
|
1020 |
//using zeno's paradox
|
|
|
1021 |
|
|
|
1022 |
self.xp += (self.windowLeftPos - self.xp) / self.options.easingAmount;
|
|
|
1023 |
self.yp += (self.windowTopPos - self.yp) / self.options.easingAmount;
|
|
|
1024 |
if(self.scrollingLock){
|
|
|
1025 |
|
|
|
1026 |
|
|
|
1027 |
clearInterval(self.loop);
|
|
|
1028 |
self.xp = self.windowLeftPos;
|
|
|
1029 |
self.yp = self.windowTopPos
|
|
|
1030 |
|
|
|
1031 |
self.xp = ((e.pageX - self.nzOffset.left) * self.widthRatio - self.zoomWindow.width() / 2) * (-1);
|
|
|
1032 |
self.yp = (((e.pageY - self.nzOffset.top) * self.heightRatio - self.zoomWindow.height() / 2) * (-1));
|
|
|
1033 |
|
|
|
1034 |
if(self.changeBgSize){
|
|
|
1035 |
if(self.nzHeight>self.nzWidth){
|
|
|
1036 |
if(self.options.zoomType == "lens"){
|
|
|
1037 |
self.zoomLens.css({ "background-size": self.largeWidth/self.newvalueheight + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
|
|
|
1038 |
}
|
|
|
1039 |
self.zoomWindow.css({ "background-size": self.largeWidth/self.newvalueheight + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
|
|
|
1040 |
}
|
|
|
1041 |
else{
|
|
|
1042 |
if(self.options.zoomType == "lens"){
|
|
|
1043 |
self.zoomLens.css({ "background-size": self.largeWidth/self.newvaluewidth + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
|
|
|
1044 |
}
|
|
|
1045 |
self.zoomWindow.css({ "background-size": self.largeWidth/self.newvaluewidth + 'px ' + self.largeHeight/self.newvaluewidth + 'px' });
|
|
|
1046 |
|
|
|
1047 |
}
|
|
|
1048 |
|
|
|
1049 |
/*
|
|
|
1050 |
if(!self.bgxp){self.bgxp = self.largeWidth/self.newvalue;}
|
|
|
1051 |
if(!self.bgyp){self.bgyp = self.largeHeight/self.newvalue ;}
|
|
|
1052 |
if (!self.bgloop){
|
|
|
1053 |
self.bgloop = setInterval(function(){
|
|
|
1054 |
|
|
|
1055 |
self.bgxp += (self.largeWidth/self.newvalue - self.bgxp) / self.options.easingAmount;
|
|
|
1056 |
self.bgyp += (self.largeHeight/self.newvalue - self.bgyp) / self.options.easingAmount;
|
|
|
1057 |
|
|
|
1058 |
self.zoomWindow.css({ "background-size": self.bgxp + 'px ' + self.bgyp + 'px' });
|
|
|
1059 |
|
|
|
1060 |
|
|
|
1061 |
}, 16);
|
|
|
1062 |
|
|
|
1063 |
}
|
|
|
1064 |
*/
|
|
|
1065 |
self.changeBgSize = false;
|
|
|
1066 |
}
|
|
|
1067 |
|
|
|
1068 |
self.zoomWindow.css({ backgroundPosition: self.windowLeftPos + 'px ' + self.windowTopPos + 'px' });
|
|
|
1069 |
self.scrollingLock = false;
|
|
|
1070 |
self.loop = false;
|
|
|
1071 |
|
|
|
1072 |
}
|
|
|
1073 |
else{
|
|
|
1074 |
if(self.changeBgSize){
|
|
|
1075 |
if(self.nzHeight>self.nzWidth){
|
|
|
1076 |
if(self.options.zoomType == "lens"){
|
|
|
1077 |
self.zoomLens.css({ "background-size": self.largeWidth/self.newvalueheight + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
|
|
|
1078 |
}
|
|
|
1079 |
self.zoomWindow.css({ "background-size": self.largeWidth/self.newvalueheight + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
|
|
|
1080 |
}
|
|
|
1081 |
else{
|
|
|
1082 |
if(self.options.zoomType != "lens"){
|
|
|
1083 |
self.zoomLens.css({ "background-size": self.largeWidth/self.newvaluewidth + 'px ' + self.largeHeight/self.newvaluewidth + 'px' });
|
|
|
1084 |
}
|
|
|
1085 |
self.zoomWindow.css({ "background-size": self.largeWidth/self.newvaluewidth + 'px ' + self.largeHeight/self.newvaluewidth + 'px' });
|
|
|
1086 |
}
|
|
|
1087 |
self.changeBgSize = false;
|
|
|
1088 |
}
|
|
|
1089 |
|
|
|
1090 |
self.zoomWindow.css({ backgroundPosition: self.xp + 'px ' + self.yp + 'px' });
|
|
|
1091 |
}
|
|
|
1092 |
}, 16);
|
|
|
1093 |
}
|
|
|
1094 |
}
|
|
|
1095 |
else{
|
|
|
1096 |
if(self.changeBgSize){
|
|
|
1097 |
if(self.nzHeight>self.nzWidth){
|
|
|
1098 |
if(self.options.zoomType == "lens"){
|
|
|
1099 |
self.zoomLens.css({ "background-size": self.largeWidth/self.newvalueheight + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
|
|
|
1100 |
}
|
|
|
1101 |
|
|
|
1102 |
self.zoomWindow.css({ "background-size": self.largeWidth/self.newvalueheight + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
|
|
|
1103 |
}
|
|
|
1104 |
else{
|
|
|
1105 |
if(self.options.zoomType == "lens"){
|
|
|
1106 |
self.zoomLens.css({ "background-size": self.largeWidth/self.newvaluewidth + 'px ' + self.largeHeight/self.newvaluewidth + 'px' });
|
|
|
1107 |
}
|
|
|
1108 |
if((self.largeHeight/self.newvaluewidth) < self.options.zoomWindowHeight){
|
|
|
1109 |
|
|
|
1110 |
self.zoomWindow.css({ "background-size": self.largeWidth/self.newvaluewidth + 'px ' + self.largeHeight/self.newvaluewidth + 'px' });
|
|
|
1111 |
}
|
|
|
1112 |
else{
|
|
|
1113 |
|
|
|
1114 |
self.zoomWindow.css({ "background-size": self.largeWidth/self.newvalueheight + 'px ' + self.largeHeight/self.newvalueheight + 'px' });
|
|
|
1115 |
}
|
|
|
1116 |
|
|
|
1117 |
}
|
|
|
1118 |
self.changeBgSize = false;
|
|
|
1119 |
}
|
|
|
1120 |
|
|
|
1121 |
self.zoomWindow.css({ backgroundPosition: self.windowLeftPos + 'px ' + self.windowTopPos + 'px' });
|
|
|
1122 |
}
|
|
|
1123 |
}
|
|
|
1124 |
},
|
|
|
1125 |
setTintPosition: function(e){
|
|
|
1126 |
var self = this;
|
|
|
1127 |
self.nzOffset = self.$elem.offset();
|
|
|
1128 |
self.tintpos = String(((e.pageX - self.nzOffset.left)-(self.zoomLens.width() / 2)) * (-1));
|
|
|
1129 |
self.tintposy = String(((e.pageY - self.nzOffset.top) - self.zoomLens.height() / 2) * (-1));
|
|
|
1130 |
if(self.Etoppos){
|
|
|
1131 |
self.tintposy = 0;
|
|
|
1132 |
}
|
|
|
1133 |
if(self.Eloppos){
|
|
|
1134 |
self.tintpos=0;
|
|
|
1135 |
}
|
|
|
1136 |
if(self.Eboppos){
|
|
|
1137 |
self.tintposy = (self.nzHeight-self.zoomLens.height()-(self.options.lensBorderSize*2))*(-1);
|
|
|
1138 |
}
|
|
|
1139 |
if(self.Eroppos){
|
|
|
1140 |
self.tintpos = ((self.nzWidth-self.zoomLens.width()-(self.options.lensBorderSize*2))*(-1));
|
|
|
1141 |
}
|
|
|
1142 |
if(self.options.tint) {
|
|
|
1143 |
//stops micro movements
|
|
|
1144 |
if(self.fullheight){
|
|
|
1145 |
self.tintposy = 0;
|
|
|
1146 |
|
|
|
1147 |
}
|
|
|
1148 |
if(self.fullwidth){
|
|
|
1149 |
self.tintpos = 0;
|
|
|
1150 |
|
|
|
1151 |
}
|
|
|
1152 |
self.zoomTintImage.css({'left': self.tintpos+'px'});
|
|
|
1153 |
self.zoomTintImage.css({'top': self.tintposy+'px'});
|
|
|
1154 |
}
|
|
|
1155 |
},
|
|
|
1156 |
|
|
|
1157 |
swaptheimage: function(smallimage, largeimage){
|
|
|
1158 |
var self = this;
|
|
|
1159 |
var newImg = new Image();
|
|
|
1160 |
|
|
|
1161 |
if(self.options.loadingIcon){
|
|
|
1162 |
self.spinner = $('<div style="background: url(\''+self.options.loadingIcon+'\') no-repeat center;height:'+self.nzHeight+'px;width:'+self.nzWidth+'px;z-index: 2000;position: absolute; background-position: center center;"></div>');
|
|
|
1163 |
self.$elem.after(self.spinner);
|
|
|
1164 |
}
|
|
|
1165 |
|
|
|
1166 |
self.options.onImageSwap(self.$elem);
|
|
|
1167 |
|
|
|
1168 |
newImg.onload = function() {
|
|
|
1169 |
self.largeWidth = newImg.width;
|
|
|
1170 |
self.largeHeight = newImg.height;
|
|
|
1171 |
self.zoomImage = largeimage;
|
|
|
1172 |
self.zoomWindow.css({ "background-size": self.largeWidth + 'px ' + self.largeHeight + 'px' });
|
|
|
1173 |
self.zoomWindow.css({ "background-size": self.largeWidth + 'px ' + self.largeHeight + 'px' });
|
|
|
1174 |
|
|
|
1175 |
|
|
|
1176 |
self.swapAction(smallimage, largeimage);
|
|
|
1177 |
return;
|
|
|
1178 |
}
|
|
|
1179 |
newImg.src = largeimage; // this must be done AFTER setting onload
|
|
|
1180 |
|
|
|
1181 |
},
|
|
|
1182 |
swapAction: function(smallimage, largeimage){
|
|
|
1183 |
|
|
|
1184 |
|
|
|
1185 |
var self = this;
|
|
|
1186 |
|
|
|
1187 |
var newImg2 = new Image();
|
|
|
1188 |
newImg2.onload = function() {
|
|
|
1189 |
//re-calculate values
|
|
|
1190 |
self.nzHeight = newImg2.height;
|
|
|
1191 |
self.nzWidth = newImg2.width;
|
|
|
1192 |
self.options.onImageSwapComplete(self.$elem);
|
|
|
1193 |
|
|
|
1194 |
self.doneCallback();
|
|
|
1195 |
return;
|
|
|
1196 |
}
|
|
|
1197 |
newImg2.src = smallimage;
|
|
|
1198 |
|
|
|
1199 |
//reset the zoomlevel to that initially set in options
|
|
|
1200 |
self.currentZoomLevel = self.options.zoomLevel;
|
|
|
1201 |
self.options.maxZoomLevel = false;
|
|
|
1202 |
|
|
|
1203 |
//swaps the main image
|
|
|
1204 |
//self.$elem.attr("src",smallimage);
|
|
|
1205 |
//swaps the zoom image
|
|
|
1206 |
if(self.options.zoomType == "lens") {
|
|
|
1207 |
self.zoomLens.css({ backgroundImage: "url('" + largeimage + "')" });
|
|
|
1208 |
}
|
|
|
1209 |
if(self.options.zoomType == "window") {
|
|
|
1210 |
self.zoomWindow.css({ backgroundImage: "url('" + largeimage + "')" });
|
|
|
1211 |
}
|
|
|
1212 |
if(self.options.zoomType == "inner") {
|
|
|
1213 |
self.zoomWindow.css({ backgroundImage: "url('" + largeimage + "')" });
|
|
|
1214 |
}
|
|
|
1215 |
|
|
|
1216 |
|
|
|
1217 |
|
|
|
1218 |
self.currentImage = largeimage;
|
|
|
1219 |
|
|
|
1220 |
if(self.options.imageCrossfade){
|
|
|
1221 |
var oldImg = self.$elem;
|
|
|
1222 |
var newImg = oldImg.clone();
|
|
|
1223 |
self.$elem.attr("src",smallimage)
|
|
|
1224 |
self.$elem.after(newImg);
|
|
|
1225 |
newImg.stop(true).fadeOut(self.options.imageCrossfade, function() {
|
|
|
1226 |
$(this).remove();
|
|
|
1227 |
});
|
|
|
1228 |
|
|
|
1229 |
// if(self.options.zoomType == "inner"){
|
|
|
1230 |
//remove any attributes on the cloned image so we can resize later
|
|
|
1231 |
self.$elem.width("auto").removeAttr("width");
|
|
|
1232 |
self.$elem.height("auto").removeAttr("height");
|
|
|
1233 |
// }
|
|
|
1234 |
|
|
|
1235 |
oldImg.fadeIn(self.options.imageCrossfade);
|
|
|
1236 |
|
|
|
1237 |
if(self.options.tint && self.options.zoomType != "inner") {
|
|
|
1238 |
|
|
|
1239 |
var oldImgTint = self.zoomTintImage;
|
|
|
1240 |
var newImgTint = oldImgTint.clone();
|
|
|
1241 |
self.zoomTintImage.attr("src",largeimage)
|
|
|
1242 |
self.zoomTintImage.after(newImgTint);
|
|
|
1243 |
newImgTint.stop(true).fadeOut(self.options.imageCrossfade, function() {
|
|
|
1244 |
$(this).remove();
|
|
|
1245 |
});
|
|
|
1246 |
|
|
|
1247 |
|
|
|
1248 |
|
|
|
1249 |
oldImgTint.fadeIn(self.options.imageCrossfade);
|
|
|
1250 |
|
|
|
1251 |
|
|
|
1252 |
//self.zoomTintImage.attr("width",elem.data("image"));
|
|
|
1253 |
|
|
|
1254 |
//resize the tint window
|
|
|
1255 |
self.zoomTint.css({ height: self.$elem.height()});
|
|
|
1256 |
self.zoomTint.css({ width: self.$elem.width()});
|
|
|
1257 |
}
|
|
|
1258 |
|
|
|
1259 |
self.zoomContainer.css("height", self.$elem.height());
|
|
|
1260 |
self.zoomContainer.css("width", self.$elem.width());
|
|
|
1261 |
|
|
|
1262 |
if(self.options.zoomType == "inner"){
|
|
|
1263 |
if(!self.options.constrainType){
|
|
|
1264 |
self.zoomWrap.parent().css("height", self.$elem.height());
|
|
|
1265 |
self.zoomWrap.parent().css("width", self.$elem.width());
|
|
|
1266 |
|
|
|
1267 |
self.zoomWindow.css("height", self.$elem.height());
|
|
|
1268 |
self.zoomWindow.css("width", self.$elem.width());
|
|
|
1269 |
}
|
|
|
1270 |
}
|
|
|
1271 |
|
|
|
1272 |
if(self.options.imageCrossfade){
|
|
|
1273 |
self.zoomWrap.css("height", self.$elem.height());
|
|
|
1274 |
self.zoomWrap.css("width", self.$elem.width());
|
|
|
1275 |
}
|
|
|
1276 |
}
|
|
|
1277 |
else{
|
|
|
1278 |
self.$elem.attr("src",smallimage);
|
|
|
1279 |
if(self.options.tint) {
|
|
|
1280 |
self.zoomTintImage.attr("src",largeimage);
|
|
|
1281 |
//self.zoomTintImage.attr("width",elem.data("image"));
|
|
|
1282 |
self.zoomTintImage.attr("height",self.$elem.height());
|
|
|
1283 |
//self.zoomTintImage.attr('src') = elem.data("image");
|
|
|
1284 |
self.zoomTintImage.css({ height: self.$elem.height()});
|
|
|
1285 |
self.zoomTint.css({ height: self.$elem.height()});
|
|
|
1286 |
|
|
|
1287 |
}
|
|
|
1288 |
self.zoomContainer.css("height", self.$elem.height());
|
|
|
1289 |
self.zoomContainer.css("width", self.$elem.width());
|
|
|
1290 |
|
|
|
1291 |
if(self.options.imageCrossfade){
|
|
|
1292 |
self.zoomWrap.css("height", self.$elem.height());
|
|
|
1293 |
self.zoomWrap.css("width", self.$elem.width());
|
|
|
1294 |
}
|
|
|
1295 |
}
|
|
|
1296 |
if(self.options.constrainType){
|
|
|
1297 |
|
|
|
1298 |
//This will contrain the image proportions
|
|
|
1299 |
if(self.options.constrainType == "height"){
|
|
|
1300 |
|
|
|
1301 |
self.zoomContainer.css("height", self.options.constrainSize);
|
|
|
1302 |
self.zoomContainer.css("width", "auto");
|
|
|
1303 |
|
|
|
1304 |
if(self.options.imageCrossfade){
|
|
|
1305 |
self.zoomWrap.css("height", self.options.constrainSize);
|
|
|
1306 |
self.zoomWrap.css("width", "auto");
|
|
|
1307 |
self.constwidth = self.zoomWrap.width();
|
|
|
1308 |
|
|
|
1309 |
|
|
|
1310 |
}
|
|
|
1311 |
else{
|
|
|
1312 |
self.$elem.css("height", self.options.constrainSize);
|
|
|
1313 |
self.$elem.css("width", "auto");
|
|
|
1314 |
self.constwidth = self.$elem.width();
|
|
|
1315 |
}
|
|
|
1316 |
|
|
|
1317 |
if(self.options.zoomType == "inner"){
|
|
|
1318 |
|
|
|
1319 |
self.zoomWrap.parent().css("height", self.options.constrainSize);
|
|
|
1320 |
self.zoomWrap.parent().css("width", self.constwidth);
|
|
|
1321 |
self.zoomWindow.css("height", self.options.constrainSize);
|
|
|
1322 |
self.zoomWindow.css("width", self.constwidth);
|
|
|
1323 |
}
|
|
|
1324 |
if(self.options.tint){
|
|
|
1325 |
self.tintContainer.css("height", self.options.constrainSize);
|
|
|
1326 |
self.tintContainer.css("width", self.constwidth);
|
|
|
1327 |
self.zoomTint.css("height", self.options.constrainSize);
|
|
|
1328 |
self.zoomTint.css("width", self.constwidth);
|
|
|
1329 |
self.zoomTintImage.css("height", self.options.constrainSize);
|
|
|
1330 |
self.zoomTintImage.css("width", self.constwidth);
|
|
|
1331 |
}
|
|
|
1332 |
|
|
|
1333 |
}
|
|
|
1334 |
if(self.options.constrainType == "width"){
|
|
|
1335 |
self.zoomContainer.css("height", "auto");
|
|
|
1336 |
self.zoomContainer.css("width", self.options.constrainSize);
|
|
|
1337 |
|
|
|
1338 |
if(self.options.imageCrossfade){
|
|
|
1339 |
self.zoomWrap.css("height", "auto");
|
|
|
1340 |
self.zoomWrap.css("width", self.options.constrainSize);
|
|
|
1341 |
self.constheight = self.zoomWrap.height();
|
|
|
1342 |
}
|
|
|
1343 |
else{
|
|
|
1344 |
self.$elem.css("height", "auto");
|
|
|
1345 |
self.$elem.css("width", self.options.constrainSize);
|
|
|
1346 |
self.constheight = self.$elem.height();
|
|
|
1347 |
}
|
|
|
1348 |
if(self.options.zoomType == "inner"){
|
|
|
1349 |
self.zoomWrap.parent().css("height", self.constheight);
|
|
|
1350 |
self.zoomWrap.parent().css("width", self.options.constrainSize);
|
|
|
1351 |
self.zoomWindow.css("height", self.constheight);
|
|
|
1352 |
self.zoomWindow.css("width", self.options.constrainSize);
|
|
|
1353 |
}
|
|
|
1354 |
if(self.options.tint){
|
|
|
1355 |
self.tintContainer.css("height", self.constheight);
|
|
|
1356 |
self.tintContainer.css("width", self.options.constrainSize);
|
|
|
1357 |
self.zoomTint.css("height", self.constheight);
|
|
|
1358 |
self.zoomTint.css("width", self.options.constrainSize);
|
|
|
1359 |
self.zoomTintImage.css("height", self.constheight);
|
|
|
1360 |
self.zoomTintImage.css("width", self.options.constrainSize);
|
|
|
1361 |
}
|
|
|
1362 |
|
|
|
1363 |
}
|
|
|
1364 |
|
|
|
1365 |
|
|
|
1366 |
}
|
|
|
1367 |
|
|
|
1368 |
},
|
|
|
1369 |
doneCallback: function(){
|
|
|
1370 |
|
|
|
1371 |
var self = this;
|
|
|
1372 |
if(self.options.loadingIcon){
|
|
|
1373 |
self.spinner.hide();
|
|
|
1374 |
}
|
|
|
1375 |
|
|
|
1376 |
self.nzOffset = self.$elem.offset();
|
|
|
1377 |
self.nzWidth = self.$elem.width();
|
|
|
1378 |
self.nzHeight = self.$elem.height();
|
|
|
1379 |
|
|
|
1380 |
// reset the zoomlevel back to default
|
|
|
1381 |
self.currentZoomLevel = self.options.zoomLevel;
|
|
|
1382 |
|
|
|
1383 |
//ratio of the large to small image
|
|
|
1384 |
self.widthRatio = self.largeWidth / self.nzWidth;
|
|
|
1385 |
self.heightRatio = self.largeHeight / self.nzHeight;
|
|
|
1386 |
|
|
|
1387 |
//NEED TO ADD THE LENS SIZE FOR ROUND
|
|
|
1388 |
// adjust images less than the window height
|
|
|
1389 |
if(self.options.zoomType == "window") {
|
|
|
1390 |
|
|
|
1391 |
if(self.nzHeight < self.options.zoomWindowWidth/self.widthRatio){
|
|
|
1392 |
lensHeight = self.nzHeight;
|
|
|
1393 |
|
|
|
1394 |
}
|
|
|
1395 |
else{
|
|
|
1396 |
lensHeight = String((self.options.zoomWindowHeight/self.heightRatio))
|
|
|
1397 |
}
|
|
|
1398 |
|
|
|
1399 |
if(self.options.zoomWindowWidth < self.options.zoomWindowWidth){
|
|
|
1400 |
lensWidth = self.nzWidth;
|
|
|
1401 |
}
|
|
|
1402 |
else{
|
|
|
1403 |
lensWidth = (self.options.zoomWindowWidth/self.widthRatio);
|
|
|
1404 |
}
|
|
|
1405 |
|
|
|
1406 |
|
|
|
1407 |
if(self.zoomLens){
|
|
|
1408 |
|
|
|
1409 |
self.zoomLens.css('width', lensWidth);
|
|
|
1410 |
self.zoomLens.css('height', lensHeight);
|
|
|
1411 |
|
|
|
1412 |
|
|
|
1413 |
}
|
|
|
1414 |
}
|
|
|
1415 |
},
|
|
|
1416 |
getCurrentImage: function(){
|
|
|
1417 |
var self = this;
|
|
|
1418 |
return self.zoomImage;
|
|
|
1419 |
},
|
|
|
1420 |
getGalleryList: function(){
|
|
|
1421 |
var self = this;
|
|
|
1422 |
//loop through the gallery options and set them in list for fancybox
|
|
|
1423 |
self.gallerylist = [];
|
|
|
1424 |
if (self.options.gallery){
|
|
|
1425 |
|
|
|
1426 |
|
|
|
1427 |
$('#'+self.options.gallery + ' a').each(function() {
|
|
|
1428 |
|
|
|
1429 |
var img_src = '';
|
|
|
1430 |
if($(this).data("zoom-image")){
|
|
|
1431 |
img_src = $(this).data("zoom-image");
|
|
|
1432 |
}
|
|
|
1433 |
else if($(this).data("image")){
|
|
|
1434 |
img_src = $(this).data("image");
|
|
|
1435 |
}
|
|
|
1436 |
//put the current image at the start
|
|
|
1437 |
if(img_src == self.zoomImage){
|
|
|
1438 |
self.gallerylist.unshift({
|
|
|
1439 |
href: ''+img_src+'',
|
|
|
1440 |
title: $(this).find('img').attr("title")
|
|
|
1441 |
});
|
|
|
1442 |
}
|
|
|
1443 |
else{
|
|
|
1444 |
self.gallerylist.push({
|
|
|
1445 |
href: ''+img_src+'',
|
|
|
1446 |
title: $(this).find('img').attr("title")
|
|
|
1447 |
});
|
|
|
1448 |
}
|
|
|
1449 |
|
|
|
1450 |
|
|
|
1451 |
});
|
|
|
1452 |
}
|
|
|
1453 |
//if no gallery - return current image
|
|
|
1454 |
else{
|
|
|
1455 |
self.gallerylist.push({
|
|
|
1456 |
href: ''+self.zoomImage+'',
|
|
|
1457 |
title: $(this).find('img').attr("title")
|
|
|
1458 |
});
|
|
|
1459 |
}
|
|
|
1460 |
return self.gallerylist;
|
|
|
1461 |
|
|
|
1462 |
},
|
|
|
1463 |
changeZoomLevel: function(value){
|
|
|
1464 |
var self = this;
|
|
|
1465 |
|
|
|
1466 |
//flag a zoom, so can adjust the easing during setPosition
|
|
|
1467 |
self.scrollingLock = true;
|
|
|
1468 |
|
|
|
1469 |
//round to two decimal places
|
|
|
1470 |
self.newvalue = parseFloat(value).toFixed(2);
|
|
|
1471 |
newvalue = parseFloat(value).toFixed(2);
|
|
|
1472 |
|
|
|
1473 |
|
|
|
1474 |
|
|
|
1475 |
|
|
|
1476 |
//maxwidth & Maxheight of the image
|
|
|
1477 |
maxheightnewvalue = self.largeHeight/((self.options.zoomWindowHeight / self.nzHeight) * self.nzHeight);
|
|
|
1478 |
maxwidthtnewvalue = self.largeWidth/((self.options.zoomWindowWidth / self.nzWidth) * self.nzWidth);
|
|
|
1479 |
|
|
|
1480 |
|
|
|
1481 |
|
|
|
1482 |
|
|
|
1483 |
//calculate new heightratio
|
|
|
1484 |
if(self.options.zoomType != "inner")
|
|
|
1485 |
{
|
|
|
1486 |
if(maxheightnewvalue <= newvalue){
|
|
|
1487 |
self.heightRatio = (self.largeHeight/maxheightnewvalue) / self.nzHeight;
|
|
|
1488 |
self.newvalueheight = maxheightnewvalue;
|
|
|
1489 |
self.fullheight = true;
|
|
|
1490 |
|
|
|
1491 |
}
|
|
|
1492 |
else{
|
|
|
1493 |
self.heightRatio = (self.largeHeight/newvalue) / self.nzHeight;
|
|
|
1494 |
self.newvalueheight = newvalue;
|
|
|
1495 |
self.fullheight = false;
|
|
|
1496 |
|
|
|
1497 |
}
|
|
|
1498 |
|
|
|
1499 |
|
|
|
1500 |
// calculate new width ratio
|
|
|
1501 |
|
|
|
1502 |
if(maxwidthtnewvalue <= newvalue){
|
|
|
1503 |
self.widthRatio = (self.largeWidth/maxwidthtnewvalue) / self.nzWidth;
|
|
|
1504 |
self.newvaluewidth = maxwidthtnewvalue;
|
|
|
1505 |
self.fullwidth = true;
|
|
|
1506 |
|
|
|
1507 |
}
|
|
|
1508 |
else{
|
|
|
1509 |
self.widthRatio = (self.largeWidth/newvalue) / self.nzWidth;
|
|
|
1510 |
self.newvaluewidth = newvalue;
|
|
|
1511 |
self.fullwidth = false;
|
|
|
1512 |
|
|
|
1513 |
}
|
|
|
1514 |
if(self.options.zoomType == "lens"){
|
|
|
1515 |
if(maxheightnewvalue <= newvalue){
|
|
|
1516 |
self.fullwidth = true;
|
|
|
1517 |
self.newvaluewidth = maxheightnewvalue;
|
|
|
1518 |
|
|
|
1519 |
} else{
|
|
|
1520 |
self.widthRatio = (self.largeWidth/newvalue) / self.nzWidth;
|
|
|
1521 |
self.newvaluewidth = newvalue;
|
|
|
1522 |
|
|
|
1523 |
self.fullwidth = false;
|
|
|
1524 |
}}
|
|
|
1525 |
}
|
|
|
1526 |
|
|
|
1527 |
|
|
|
1528 |
|
|
|
1529 |
if(self.options.zoomType == "inner")
|
|
|
1530 |
{
|
|
|
1531 |
maxheightnewvalue = parseFloat(self.largeHeight/self.nzHeight).toFixed(2);
|
|
|
1532 |
maxwidthtnewvalue = parseFloat(self.largeWidth/self.nzWidth).toFixed(2);
|
|
|
1533 |
if(newvalue > maxheightnewvalue){
|
|
|
1534 |
newvalue = maxheightnewvalue;
|
|
|
1535 |
}
|
|
|
1536 |
if(newvalue > maxwidthtnewvalue){
|
|
|
1537 |
newvalue = maxwidthtnewvalue;
|
|
|
1538 |
}
|
|
|
1539 |
|
|
|
1540 |
|
|
|
1541 |
if(maxheightnewvalue <= newvalue){
|
|
|
1542 |
|
|
|
1543 |
|
|
|
1544 |
self.heightRatio = (self.largeHeight/newvalue) / self.nzHeight;
|
|
|
1545 |
if(newvalue > maxheightnewvalue){
|
|
|
1546 |
self.newvalueheight = maxheightnewvalue;
|
|
|
1547 |
}else{
|
|
|
1548 |
self.newvalueheight = newvalue;
|
|
|
1549 |
}
|
|
|
1550 |
self.fullheight = true;
|
|
|
1551 |
|
|
|
1552 |
|
|
|
1553 |
}
|
|
|
1554 |
else{
|
|
|
1555 |
|
|
|
1556 |
|
|
|
1557 |
|
|
|
1558 |
self.heightRatio = (self.largeHeight/newvalue) / self.nzHeight;
|
|
|
1559 |
|
|
|
1560 |
if(newvalue > maxheightnewvalue){
|
|
|
1561 |
|
|
|
1562 |
self.newvalueheight = maxheightnewvalue;
|
|
|
1563 |
}else{
|
|
|
1564 |
self.newvalueheight = newvalue;
|
|
|
1565 |
}
|
|
|
1566 |
self.fullheight = false;
|
|
|
1567 |
}
|
|
|
1568 |
|
|
|
1569 |
|
|
|
1570 |
|
|
|
1571 |
|
|
|
1572 |
if(maxwidthtnewvalue <= newvalue){
|
|
|
1573 |
|
|
|
1574 |
self.widthRatio = (self.largeWidth/newvalue) / self.nzWidth;
|
|
|
1575 |
if(newvalue > maxwidthtnewvalue){
|
|
|
1576 |
|
|
|
1577 |
self.newvaluewidth = maxwidthtnewvalue;
|
|
|
1578 |
}else{
|
|
|
1579 |
self.newvaluewidth = newvalue;
|
|
|
1580 |
}
|
|
|
1581 |
|
|
|
1582 |
self.fullwidth = true;
|
|
|
1583 |
|
|
|
1584 |
|
|
|
1585 |
}
|
|
|
1586 |
else{
|
|
|
1587 |
|
|
|
1588 |
self.widthRatio = (self.largeWidth/newvalue) / self.nzWidth;
|
|
|
1589 |
self.newvaluewidth = newvalue;
|
|
|
1590 |
self.fullwidth = false;
|
|
|
1591 |
}
|
|
|
1592 |
|
|
|
1593 |
|
|
|
1594 |
} //end inner
|
|
|
1595 |
scrcontinue = false;
|
|
|
1596 |
|
|
|
1597 |
if(self.options.zoomType == "inner"){
|
|
|
1598 |
|
|
|
1599 |
if(self.nzWidth > self.nzHeight){
|
|
|
1600 |
if( self.newvaluewidth <= maxwidthtnewvalue){
|
|
|
1601 |
scrcontinue = true;
|
|
|
1602 |
}
|
|
|
1603 |
else{
|
|
|
1604 |
|
|
|
1605 |
scrcontinue = false;
|
|
|
1606 |
self.fullheight = true;
|
|
|
1607 |
self.fullwidth = true;
|
|
|
1608 |
}
|
|
|
1609 |
}
|
|
|
1610 |
if(self.nzHeight > self.nzWidth){
|
|
|
1611 |
if( self.newvaluewidth <= maxwidthtnewvalue){
|
|
|
1612 |
scrcontinue = true;
|
|
|
1613 |
}
|
|
|
1614 |
else{
|
|
|
1615 |
scrcontinue = false;
|
|
|
1616 |
|
|
|
1617 |
self.fullheight = true;
|
|
|
1618 |
self.fullwidth = true;
|
|
|
1619 |
}
|
|
|
1620 |
}
|
|
|
1621 |
}
|
|
|
1622 |
|
|
|
1623 |
if(self.options.zoomType != "inner"){
|
|
|
1624 |
scrcontinue = true;
|
|
|
1625 |
}
|
|
|
1626 |
|
|
|
1627 |
if(scrcontinue){
|
|
|
1628 |
|
|
|
1629 |
|
|
|
1630 |
|
|
|
1631 |
self.zoomLock = 0;
|
|
|
1632 |
self.changeZoom = true;
|
|
|
1633 |
|
|
|
1634 |
//if lens height is less than image height
|
|
|
1635 |
|
|
|
1636 |
|
|
|
1637 |
if(((self.options.zoomWindowHeight)/self.heightRatio) <= self.nzHeight){
|
|
|
1638 |
|
|
|
1639 |
|
|
|
1640 |
self.currentZoomLevel = self.newvalueheight;
|
|
|
1641 |
if(self.options.zoomType != "lens" && self.options.zoomType != "inner") {
|
|
|
1642 |
self.changeBgSize = true;
|
|
|
1643 |
|
|
|
1644 |
self.zoomLens.css({height: String((self.options.zoomWindowHeight)/self.heightRatio) + 'px' })
|
|
|
1645 |
}
|
|
|
1646 |
if(self.options.zoomType == "lens" || self.options.zoomType == "inner") {
|
|
|
1647 |
self.changeBgSize = true;
|
|
|
1648 |
}
|
|
|
1649 |
|
|
|
1650 |
|
|
|
1651 |
}
|
|
|
1652 |
|
|
|
1653 |
|
|
|
1654 |
|
|
|
1655 |
|
|
|
1656 |
if((self.options.zoomWindowWidth/self.widthRatio) <= self.nzWidth){
|
|
|
1657 |
|
|
|
1658 |
|
|
|
1659 |
|
|
|
1660 |
if(self.options.zoomType != "inner"){
|
|
|
1661 |
if(self.newvaluewidth > self.newvalueheight) {
|
|
|
1662 |
self.currentZoomLevel = self.newvaluewidth;
|
|
|
1663 |
|
|
|
1664 |
}
|
|
|
1665 |
}
|
|
|
1666 |
|
|
|
1667 |
if(self.options.zoomType != "lens" && self.options.zoomType != "inner") {
|
|
|
1668 |
self.changeBgSize = true;
|
|
|
1669 |
|
|
|
1670 |
self.zoomLens.css({width: String((self.options.zoomWindowWidth)/self.widthRatio) + 'px' })
|
|
|
1671 |
}
|
|
|
1672 |
if(self.options.zoomType == "lens" || self.options.zoomType == "inner") {
|
|
|
1673 |
self.changeBgSize = true;
|
|
|
1674 |
}
|
|
|
1675 |
|
|
|
1676 |
}
|
|
|
1677 |
if(self.options.zoomType == "inner"){
|
|
|
1678 |
self.changeBgSize = true;
|
|
|
1679 |
|
|
|
1680 |
if(self.nzWidth > self.nzHeight){
|
|
|
1681 |
self.currentZoomLevel = self.newvaluewidth;
|
|
|
1682 |
}
|
|
|
1683 |
if(self.nzHeight > self.nzWidth){
|
|
|
1684 |
self.currentZoomLevel = self.newvaluewidth;
|
|
|
1685 |
}
|
|
|
1686 |
}
|
|
|
1687 |
|
|
|
1688 |
} //under
|
|
|
1689 |
|
|
|
1690 |
//sets the boundry change, called in setWindowPos
|
|
|
1691 |
self.setPosition(self.currentLoc);
|
|
|
1692 |
//
|
|
|
1693 |
},
|
|
|
1694 |
closeAll: function(){
|
|
|
1695 |
if(self.zoomWindow){self.zoomWindow.hide();}
|
|
|
1696 |
if(self.zoomLens){self.zoomLens.hide();}
|
|
|
1697 |
if(self.zoomTint){self.zoomTint.hide();}
|
|
|
1698 |
},
|
|
|
1699 |
changeState: function(value){
|
|
|
1700 |
var self = this;
|
|
|
1701 |
if(value == 'enable'){self.options.zoomEnabled = true;}
|
|
|
1702 |
if(value == 'disable'){self.options.zoomEnabled = false;}
|
|
|
1703 |
|
|
|
1704 |
}
|
|
|
1705 |
|
|
|
1706 |
};
|
|
|
1707 |
|
|
|
1708 |
|
|
|
1709 |
|
|
|
1710 |
|
|
|
1711 |
$.fn.elevateZoom = function( options ) {
|
|
|
1712 |
return this.each(function() {
|
|
|
1713 |
var elevate = Object.create( ElevateZoom );
|
|
|
1714 |
|
|
|
1715 |
elevate.init( options, this );
|
|
|
1716 |
|
|
|
1717 |
$.data( this, 'elevateZoom', elevate );
|
|
|
1718 |
|
|
|
1719 |
});
|
|
|
1720 |
};
|
|
|
1721 |
|
|
|
1722 |
$.fn.elevateZoom.options = {
|
|
|
1723 |
zoomActivation: "hover", // Can also be click (PLACEHOLDER FOR NEXT VERSION)
|
|
|
1724 |
zoomEnabled: true, //false disables zoomwindow from showing
|
|
|
1725 |
preloading: 1, //by default, load all the images, if 0, then only load images after activated (PLACEHOLDER FOR NEXT VERSION)
|
|
|
1726 |
zoomLevel: 1, //default zoom level of image
|
|
|
1727 |
scrollZoom: false, //allow zoom on mousewheel, true to activate
|
|
|
1728 |
scrollZoomIncrement: 0.1, //steps of the scrollzoom
|
|
|
1729 |
minZoomLevel: false,
|
|
|
1730 |
maxZoomLevel: false,
|
|
|
1731 |
easing: false,
|
|
|
1732 |
easingAmount: 12,
|
|
|
1733 |
lensSize: 200,
|
|
|
1734 |
zoomWindowWidth: 400,
|
|
|
1735 |
zoomWindowHeight: 400,
|
|
|
1736 |
zoomWindowOffetx: 0,
|
|
|
1737 |
zoomWindowOffety: 0,
|
|
|
1738 |
zoomWindowPosition: 1,
|
|
|
1739 |
zoomWindowBgColour: "#fff",
|
|
|
1740 |
lensFadeIn: false,
|
|
|
1741 |
lensFadeOut: false,
|
|
|
1742 |
debug: false,
|
|
|
1743 |
zoomWindowFadeIn: false,
|
|
|
1744 |
zoomWindowFadeOut: false,
|
|
|
1745 |
zoomWindowAlwaysShow: false,
|
|
|
1746 |
zoomTintFadeIn: false,
|
|
|
1747 |
zoomTintFadeOut: false,
|
|
|
1748 |
borderSize: 4,
|
|
|
1749 |
showLens: true,
|
|
|
1750 |
borderColour: "#888",
|
|
|
1751 |
lensBorderSize: 1,
|
|
|
1752 |
lensBorderColour: "#000",
|
|
|
1753 |
lensShape: "square", //can be "round"
|
|
|
1754 |
zoomType: "window", //window is default, also "lens" available -
|
|
|
1755 |
containLensZoom: false,
|
|
|
1756 |
lensColour: "white", //colour of the lens background
|
|
|
1757 |
lensOpacity: 0.4, //opacity of the lens
|
|
|
1758 |
lenszoom: false,
|
|
|
1759 |
tint: false, //enable the tinting
|
|
|
1760 |
tintColour: "#333", //default tint color, can be anything, red, #ccc, rgb(0,0,0)
|
|
|
1761 |
tintOpacity: 0.4, //opacity of the tint
|
|
|
1762 |
gallery: false,
|
|
|
1763 |
galleryActiveClass: "zoomGalleryActive",
|
|
|
1764 |
imageCrossfade: false,
|
|
|
1765 |
constrainType: false, //width or height
|
|
|
1766 |
constrainSize: false, //in pixels the dimensions you want to constrain on
|
|
|
1767 |
loadingIcon: false, //http://www.example.com/spinner.gif
|
|
|
1768 |
cursor:"default", // user should set to what they want the cursor as, if they have set a click function
|
|
|
1769 |
responsive:true,
|
|
|
1770 |
onComplete: $.noop,
|
|
|
1771 |
onZoomedImageLoaded: function() {},
|
|
|
1772 |
onImageSwap: $.noop,
|
|
|
1773 |
onImageSwapComplete: $.noop
|
|
|
1774 |
};
|
|
|
1775 |
|
|
|
1776 |
})( jQuery, window, document );
|