Version Notes
This extension provide zoom functionality over product detail page for product images.
Download this release
Release Info
Developer | Magento Core Team |
Extension | VS_Featurezoom |
Version | 1.2.1.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.1.0 to 1.2.1.0
app/code/community/VS/Featurezoom/Model/Magnifierpos.php
CHANGED
@@ -1,19 +1,4 @@
|
|
1 |
<?php
|
2 |
-
/**
|
3 |
-
* aheadWorks Co.
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the EULA
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://ecommerce.aheadworks.com/LICENSE-L.txt
|
11 |
-
*
|
12 |
-
* @category AW
|
13 |
-
* @package AW_Blog
|
14 |
-
* @copyright Copyright (c) 2009-2010 aheadWorks Co. (http://www.aheadworks.com)
|
15 |
-
* @license http://ecommerce.aheadworks.com/LICENSE-L.txt
|
16 |
-
*/
|
17 |
|
18 |
class VS_Featurezoom_Model_Magnifierpos{
|
19 |
protected $_options;
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
class VS_Featurezoom_Model_Magnifierpos{
|
4 |
protected $_options;
|
app/code/community/VS/Featurezoom/etc/config.xml
CHANGED
@@ -78,7 +78,7 @@
|
|
78 |
<config>
|
79 |
<children>
|
80 |
<featurezoom>
|
81 |
-
<title>
|
82 |
</featurezoom>
|
83 |
</children>
|
84 |
</config>
|
78 |
<config>
|
79 |
<children>
|
80 |
<featurezoom>
|
81 |
+
<title>VS Featurezoom</title>
|
82 |
</featurezoom>
|
83 |
</children>
|
84 |
</config>
|
app/design/frontend/default/default/layout/featurezoom.xml
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
<catalog_product_view>
|
6 |
<reference name="head">
|
7 |
-
<action method="addJs"><script>VS/jquery-1.6.4.js</script></action>
|
8 |
<action method="addJs" ifconfig="featurezoom/general/enabled"><script>VS/featuredimagezoomer.js</script></action>
|
9 |
</reference>
|
10 |
<reference name="product.info.media">
|
@@ -14,7 +14,7 @@
|
|
14 |
|
15 |
<review_product_list>
|
16 |
<reference name="head">
|
17 |
-
<action method="addJs"><script>VS/jquery-1.6.4.js</script></action>
|
18 |
<action method="addJs" ifconfig="featurezoom/general/enabled"><script>VS/featuredimagezoomer.js</script></action>
|
19 |
|
20 |
</reference>
|
4 |
|
5 |
<catalog_product_view>
|
6 |
<reference name="head">
|
7 |
+
<action method="addJs" ifconfig="featurezoom/general/enabled"><script>VS/jquery-1.6.4.js</script></action>
|
8 |
<action method="addJs" ifconfig="featurezoom/general/enabled"><script>VS/featuredimagezoomer.js</script></action>
|
9 |
</reference>
|
10 |
<reference name="product.info.media">
|
14 |
|
15 |
<review_product_list>
|
16 |
<reference name="head">
|
17 |
+
<action method="addJs" ifconfig="featurezoom/general/enabled"><script>VS/jquery-1.6.4.js</script></action>
|
18 |
<action method="addJs" ifconfig="featurezoom/general/enabled"><script>VS/featuredimagezoomer.js</script></action>
|
19 |
|
20 |
</reference>
|
app/etc/modules/VS_Featurezoom.xml
CHANGED
@@ -1,14 +1,4 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<!--
|
3 |
-
/**
|
4 |
-
*
|
5 |
-
* Package :- CueBlocks_Featurezoom-1.5.tgz
|
6 |
-
* Version :- 1.5
|
7 |
-
* Edition :- Community
|
8 |
-
* Developed By :- CueBlocks.com
|
9 |
-
*
|
10 |
-
*/
|
11 |
-
-->
|
12 |
<config>
|
13 |
<modules>
|
14 |
<VS_Featurezoom>
|
1 |
<?xml version="1.0"?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<VS_Featurezoom>
|
js/VS/Thumbs.db
CHANGED
Binary file
|
js/VS/lightbox.js
ADDED
@@ -0,0 +1,480 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// -----------------------------------------------------------------------------------
|
2 |
+
//
|
3 |
+
// Lightbox v2.05
|
4 |
+
// by Lokesh Dhakar - http://www.lokeshdhakar.com
|
5 |
+
// Last Modification: 3/18/11
|
6 |
+
//
|
7 |
+
// For more information, visit:
|
8 |
+
// http://lokeshdhakar.com/projects/lightbox2/
|
9 |
+
//
|
10 |
+
// Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
|
11 |
+
// - Free for use in both personal and commercial projects
|
12 |
+
// - Attribution requires leaving author name, author link, and the license info intact.
|
13 |
+
//
|
14 |
+
// Thanks: Scott Upton(uptonic.com), Peter-Paul Koch(quirksmode.com), and Thomas Fuchs(mir.aculo.us) for ideas, libs, and snippets.
|
15 |
+
// Artemy Tregubenko (arty.name) for cleanup and help in updating to latest ver of proto-aculous.
|
16 |
+
//
|
17 |
+
// -----------------------------------------------------------------------------------
|
18 |
+
/*
|
19 |
+
|
20 |
+
Table of Contents
|
21 |
+
-----------------
|
22 |
+
Configuration
|
23 |
+
|
24 |
+
Lightbox Class Declaration
|
25 |
+
- initialize()
|
26 |
+
- updateImageList()
|
27 |
+
- start()
|
28 |
+
- changeImage()
|
29 |
+
- resizeImageContainer()
|
30 |
+
- showImage()
|
31 |
+
- updateDetails()
|
32 |
+
- updateNav()
|
33 |
+
- enableKeyboardNav()
|
34 |
+
- disableKeyboardNav()
|
35 |
+
- keyboardAction()
|
36 |
+
- preloadNeighborImages()
|
37 |
+
- end()
|
38 |
+
|
39 |
+
Function Calls
|
40 |
+
- document.observe()
|
41 |
+
|
42 |
+
*/
|
43 |
+
// -----------------------------------------------------------------------------------
|
44 |
+
|
45 |
+
//
|
46 |
+
// Configurationl
|
47 |
+
//
|
48 |
+
|
49 |
+
// -----------------------------------------------------------------------------------
|
50 |
+
|
51 |
+
var Lightbox = Class.create();
|
52 |
+
|
53 |
+
Lightbox.prototype = {
|
54 |
+
imageArray: [],
|
55 |
+
activeImage: undefined,
|
56 |
+
|
57 |
+
// initialize()
|
58 |
+
// Constructor runs on completion of the DOM loading. Calls updateImageList and then
|
59 |
+
// the function inserts html at the bottom of the page which is used to display the shadow
|
60 |
+
// overlay and the image container.
|
61 |
+
//
|
62 |
+
initialize: function() {
|
63 |
+
|
64 |
+
this.updateImageList();
|
65 |
+
|
66 |
+
this.keyboardAction = this.keyboardAction.bindAsEventListener(this);
|
67 |
+
|
68 |
+
if (LightboxOptions.resizeSpeed > 10) LightboxOptions.resizeSpeed = 10;
|
69 |
+
if (LightboxOptions.resizeSpeed < 1) LightboxOptions.resizeSpeed = 1;
|
70 |
+
|
71 |
+
this.resizeDuration = LightboxOptions.animate ? ((11 - LightboxOptions.resizeSpeed) * 0.15) : 0;
|
72 |
+
this.overlayDuration = LightboxOptions.animate ? 0.2 : 0; // shadow fade in/out duration
|
73 |
+
|
74 |
+
// When Lightbox starts it will resize itself from 250 by 250 to the current image dimension.
|
75 |
+
// If animations are turned off, it will be hidden as to prevent a flicker of a
|
76 |
+
// white 250 by 250 box.
|
77 |
+
var size = (LightboxOptions.animate ? 250 : 1) + 'px';
|
78 |
+
|
79 |
+
|
80 |
+
// Code inserts html at the bottom of the page that looks similar to this:
|
81 |
+
//
|
82 |
+
// <div id="overlay"></div>
|
83 |
+
// <div id="lightbox">
|
84 |
+
// <div id="outerImageContainer">
|
85 |
+
// <div id="imageContainer">
|
86 |
+
// <img id="lightboxImage">
|
87 |
+
// <div style="" id="hoverNav">
|
88 |
+
// <a href="#" id="prevLink"></a>
|
89 |
+
// <a href="#" id="nextLink"></a>
|
90 |
+
// </div>
|
91 |
+
// <div id="loading">
|
92 |
+
// <a href="#" id="loadingLink">
|
93 |
+
// <img src="images/loading.gif">
|
94 |
+
// </a>
|
95 |
+
// </div>
|
96 |
+
// </div>
|
97 |
+
// </div>
|
98 |
+
// <div id="imageDataContainer">
|
99 |
+
// <div id="imageData">
|
100 |
+
// <div id="imageDetails">
|
101 |
+
// <span id="caption"></span>
|
102 |
+
// <span id="numberDisplay"></span>
|
103 |
+
// </div>
|
104 |
+
// <div id="bottomNav">
|
105 |
+
// <a href="#" id="bottomNavClose">
|
106 |
+
// <img src="images/close.gif">
|
107 |
+
// </a>
|
108 |
+
// </div>
|
109 |
+
// </div>
|
110 |
+
// </div>
|
111 |
+
// </div>
|
112 |
+
|
113 |
+
|
114 |
+
var objBody = $$('body')[0];
|
115 |
+
|
116 |
+
objBody.appendChild(Builder.node('div',{id:'overlay'}));
|
117 |
+
|
118 |
+
objBody.appendChild(Builder.node('div',{id:'lightbox'}, [
|
119 |
+
Builder.node('div',{id:'outerImageContainer'},
|
120 |
+
Builder.node('div',{id:'imageContainer'}, [
|
121 |
+
Builder.node('img',{id:'lightboxImage'}),
|
122 |
+
Builder.node('div',{id:'hoverNav'}, [
|
123 |
+
Builder.node('a',{id:'prevLink', href: '#' }),
|
124 |
+
Builder.node('a',{id:'nextLink', href: '#' })
|
125 |
+
]),
|
126 |
+
Builder.node('div',{id:'loading'},
|
127 |
+
Builder.node('a',{id:'loadingLink', href: '#' },
|
128 |
+
Builder.node('img', {src: LightboxOptions.fileLoadingImage})
|
129 |
+
)
|
130 |
+
)
|
131 |
+
])
|
132 |
+
),
|
133 |
+
Builder.node('div', {id:'imageDataContainer'},
|
134 |
+
Builder.node('div',{id:'imageData'}, [
|
135 |
+
Builder.node('div',{id:'imageDetails'}, [
|
136 |
+
Builder.node('span',{id:'caption'}),
|
137 |
+
Builder.node('span',{id:'numberDisplay'})
|
138 |
+
]),
|
139 |
+
Builder.node('div',{id:'bottomNav'},
|
140 |
+
Builder.node('a',{id:'bottomNavClose', href: '#' },
|
141 |
+
Builder.node('img', { src: LightboxOptions.fileBottomNavCloseImage })
|
142 |
+
)
|
143 |
+
)
|
144 |
+
])
|
145 |
+
)
|
146 |
+
]));
|
147 |
+
|
148 |
+
|
149 |
+
$('overlay').hide().observe('click', (function() { this.end(); }).bind(this));
|
150 |
+
$('lightbox').hide().observe('click', (function(event) { if (event.element().id == 'lightbox') this.end(); }).bind(this));
|
151 |
+
$('outerImageContainer').setStyle({ width: size, height: size });
|
152 |
+
$('prevLink').observe('click', (function(event) { event.stop(); this.changeImage(this.activeImage - 1); }).bindAsEventListener(this));
|
153 |
+
$('nextLink').observe('click', (function(event) { event.stop(); this.changeImage(this.activeImage + 1); }).bindAsEventListener(this));
|
154 |
+
$('loadingLink').observe('click', (function(event) { event.stop(); this.end(); }).bind(this));
|
155 |
+
$('bottomNavClose').observe('click', (function(event) { event.stop(); this.end(); }).bind(this));
|
156 |
+
|
157 |
+
var th = this;
|
158 |
+
(function(){
|
159 |
+
var ids =
|
160 |
+
'overlay lightbox outerImageContainer imageContainer lightboxImage hoverNav prevLink nextLink loading loadingLink ' +
|
161 |
+
'imageDataContainer imageData imageDetails caption numberDisplay bottomNav bottomNavClose';
|
162 |
+
$w(ids).each(function(id){ th[id] = $(id); });
|
163 |
+
}).defer();
|
164 |
+
},
|
165 |
+
|
166 |
+
//
|
167 |
+
// updateImageList()
|
168 |
+
// Loops through anchor tags looking for 'lightbox' references and applies onclick
|
169 |
+
// events to appropriate links. You can rerun after dynamically adding images w/ajax.
|
170 |
+
//
|
171 |
+
updateImageList: function() {
|
172 |
+
this.updateImageList = Prototype.emptyFunction;
|
173 |
+
|
174 |
+
document.observe('click', (function(event){
|
175 |
+
var target = event.findElement('a[rel^=lightbox]') || event.findElement('area[rel^=lightbox]');
|
176 |
+
if (target) {
|
177 |
+
event.stop();
|
178 |
+
this.start(target);
|
179 |
+
}
|
180 |
+
}).bind(this));
|
181 |
+
},
|
182 |
+
|
183 |
+
//
|
184 |
+
// start()
|
185 |
+
// Display overlay and lightbox. If image is part of a set, add siblings to imageArray.
|
186 |
+
//
|
187 |
+
start: function(imageLink) {
|
188 |
+
|
189 |
+
$$('select', 'object', 'embed').each(function(node){ node.style.visibility = 'hidden' });
|
190 |
+
|
191 |
+
// stretch overlay to fill page and fade in
|
192 |
+
var arrayPageSize = this.getPageSize();
|
193 |
+
$('overlay').setStyle({ width: arrayPageSize[0] + 'px', height: arrayPageSize[1] + 'px' });
|
194 |
+
|
195 |
+
new Effect.Appear(this.overlay, { duration: this.overlayDuration, from: 0.0, to: LightboxOptions.overlayOpacity });
|
196 |
+
|
197 |
+
this.imageArray = [];
|
198 |
+
var imageNum = 0;
|
199 |
+
|
200 |
+
if ((imageLink.getAttribute("rel") == 'lightbox')){
|
201 |
+
// if image is NOT part of a set, add single image to imageArray
|
202 |
+
this.imageArray.push([imageLink.href, imageLink.title]);
|
203 |
+
} else {
|
204 |
+
// if image is part of a set..
|
205 |
+
this.imageArray =
|
206 |
+
$$(imageLink.tagName + '[href][rel="' + imageLink.rel + '"]').
|
207 |
+
collect(function(anchor){ return [anchor.href, anchor.title]; }).
|
208 |
+
uniq();
|
209 |
+
|
210 |
+
while (this.imageArray[imageNum][0] != imageLink.href) { imageNum++; }
|
211 |
+
}
|
212 |
+
|
213 |
+
// calculate top and left offset for the lightbox
|
214 |
+
var arrayPageScroll = document.viewport.getScrollOffsets();
|
215 |
+
var lightboxTop = arrayPageScroll[1] + (document.viewport.getHeight() / 10);
|
216 |
+
var lightboxLeft = arrayPageScroll[0];
|
217 |
+
this.lightbox.setStyle({ top: lightboxTop + 'px', left: lightboxLeft + 'px' }).show();
|
218 |
+
|
219 |
+
this.changeImage(imageNum);
|
220 |
+
},
|
221 |
+
|
222 |
+
//
|
223 |
+
// changeImage()
|
224 |
+
// Hide most elements and preload image in preparation for resizing image container.
|
225 |
+
//
|
226 |
+
changeImage: function(imageNum) {
|
227 |
+
|
228 |
+
this.activeImage = imageNum; // update global var
|
229 |
+
|
230 |
+
// hide elements during transition
|
231 |
+
if (LightboxOptions.animate) this.loading.show();
|
232 |
+
this.lightboxImage.hide();
|
233 |
+
this.hoverNav.hide();
|
234 |
+
this.prevLink.hide();
|
235 |
+
this.nextLink.hide();
|
236 |
+
// HACK: Opera9 does not currently support scriptaculous opacity and appear fx
|
237 |
+
this.imageDataContainer.setStyle({opacity: .0001});
|
238 |
+
this.numberDisplay.hide();
|
239 |
+
|
240 |
+
var imgPreloader = new Image();
|
241 |
+
|
242 |
+
// once image is preloaded, resize image container
|
243 |
+
imgPreloader.onload = (function(){
|
244 |
+
this.lightboxImage.src = this.imageArray[this.activeImage][0];
|
245 |
+
/*Bug Fixed by Andy Scott*/
|
246 |
+
this.lightboxImage.width = imgPreloader.width;
|
247 |
+
this.lightboxImage.height = imgPreloader.height;
|
248 |
+
/*End of Bug Fix*/
|
249 |
+
this.resizeImageContainer(imgPreloader.width, imgPreloader.height);
|
250 |
+
}).bind(this);
|
251 |
+
imgPreloader.src = this.imageArray[this.activeImage][0];
|
252 |
+
},
|
253 |
+
|
254 |
+
//
|
255 |
+
// resizeImageContainer()
|
256 |
+
//
|
257 |
+
resizeImageContainer: function(imgWidth, imgHeight) {
|
258 |
+
|
259 |
+
// get current width and height
|
260 |
+
var widthCurrent = this.outerImageContainer.getWidth();
|
261 |
+
var heightCurrent = this.outerImageContainer.getHeight();
|
262 |
+
|
263 |
+
// get new width and height
|
264 |
+
var widthNew = (imgWidth + LightboxOptions.borderSize * 2);
|
265 |
+
var heightNew = (imgHeight + LightboxOptions.borderSize * 2);
|
266 |
+
|
267 |
+
// scalars based on change from old to new
|
268 |
+
var xScale = (widthNew / widthCurrent) * 100;
|
269 |
+
var yScale = (heightNew / heightCurrent) * 100;
|
270 |
+
|
271 |
+
// calculate size difference between new and old image, and resize if necessary
|
272 |
+
var wDiff = widthCurrent - widthNew;
|
273 |
+
var hDiff = heightCurrent - heightNew;
|
274 |
+
|
275 |
+
if (hDiff != 0) new Effect.Scale(this.outerImageContainer, yScale, {scaleX: false, duration: this.resizeDuration, queue: 'front'});
|
276 |
+
if (wDiff != 0) new Effect.Scale(this.outerImageContainer, xScale, {scaleY: false, duration: this.resizeDuration, delay: this.resizeDuration});
|
277 |
+
|
278 |
+
// if new and old image are same size and no scaling transition is necessary,
|
279 |
+
// do a quick pause to prevent image flicker.
|
280 |
+
var timeout = 0;
|
281 |
+
if ((hDiff == 0) && (wDiff == 0)){
|
282 |
+
timeout = 100;
|
283 |
+
if (Prototype.Browser.IE) timeout = 250;
|
284 |
+
}
|
285 |
+
|
286 |
+
(function(){
|
287 |
+
this.prevLink.setStyle({ height: imgHeight + 'px' });
|
288 |
+
this.nextLink.setStyle({ height: imgHeight + 'px' });
|
289 |
+
this.imageDataContainer.setStyle({ width: widthNew + 'px' });
|
290 |
+
|
291 |
+
this.showImage();
|
292 |
+
}).bind(this).delay(timeout / 1000);
|
293 |
+
},
|
294 |
+
|
295 |
+
//
|
296 |
+
// showImage()
|
297 |
+
// Display image and begin preloading neighbors.
|
298 |
+
//
|
299 |
+
showImage: function(){
|
300 |
+
this.loading.hide();
|
301 |
+
new Effect.Appear(this.lightboxImage, {
|
302 |
+
duration: this.resizeDuration,
|
303 |
+
queue: 'end',
|
304 |
+
afterFinish: (function(){ this.updateDetails(); }).bind(this)
|
305 |
+
});
|
306 |
+
this.preloadNeighborImages();
|
307 |
+
},
|
308 |
+
|
309 |
+
//
|
310 |
+
// updateDetails()
|
311 |
+
// Display caption, image number, and bottom nav.
|
312 |
+
//
|
313 |
+
updateDetails: function() {
|
314 |
+
|
315 |
+
this.caption.update(this.imageArray[this.activeImage][1]).show();
|
316 |
+
|
317 |
+
// if image is part of set display 'Image x of x'
|
318 |
+
if (this.imageArray.length > 1){
|
319 |
+
this.numberDisplay.update( LightboxOptions.labelImage + ' ' + (this.activeImage + 1) + ' ' + LightboxOptions.labelOf + ' ' + this.imageArray.length).show();
|
320 |
+
}
|
321 |
+
|
322 |
+
new Effect.Parallel(
|
323 |
+
[
|
324 |
+
new Effect.SlideDown(this.imageDataContainer, { sync: true, duration: this.resizeDuration, from: 0.0, to: 1.0 }),
|
325 |
+
new Effect.Appear(this.imageDataContainer, { sync: true, duration: this.resizeDuration })
|
326 |
+
],
|
327 |
+
{
|
328 |
+
duration: this.resizeDuration,
|
329 |
+
afterFinish: (function() {
|
330 |
+
// update overlay size and update nav
|
331 |
+
var arrayPageSize = this.getPageSize();
|
332 |
+
this.overlay.setStyle({ width: arrayPageSize[0] + 'px', height: arrayPageSize[1] + 'px' });
|
333 |
+
this.updateNav();
|
334 |
+
}).bind(this)
|
335 |
+
}
|
336 |
+
);
|
337 |
+
},
|
338 |
+
|
339 |
+
//
|
340 |
+
// updateNav()
|
341 |
+
// Display appropriate previous and next hover navigation.
|
342 |
+
//
|
343 |
+
updateNav: function() {
|
344 |
+
|
345 |
+
this.hoverNav.show();
|
346 |
+
|
347 |
+
// if not first image in set, display prev image button
|
348 |
+
if (this.activeImage > 0) this.prevLink.show();
|
349 |
+
|
350 |
+
// if not last image in set, display next image button
|
351 |
+
if (this.activeImage < (this.imageArray.length - 1)) this.nextLink.show();
|
352 |
+
|
353 |
+
this.enableKeyboardNav();
|
354 |
+
},
|
355 |
+
|
356 |
+
//
|
357 |
+
// enableKeyboardNav()
|
358 |
+
//
|
359 |
+
enableKeyboardNav: function() {
|
360 |
+
document.observe('keydown', this.keyboardAction);
|
361 |
+
},
|
362 |
+
|
363 |
+
//
|
364 |
+
// disableKeyboardNav()
|
365 |
+
//
|
366 |
+
disableKeyboardNav: function() {
|
367 |
+
document.stopObserving('keydown', this.keyboardAction);
|
368 |
+
},
|
369 |
+
|
370 |
+
//
|
371 |
+
// keyboardAction()
|
372 |
+
//
|
373 |
+
keyboardAction: function(event) {
|
374 |
+
var keycode = event.keyCode;
|
375 |
+
|
376 |
+
var escapeKey;
|
377 |
+
if (event.DOM_VK_ESCAPE) { // mozilla
|
378 |
+
escapeKey = event.DOM_VK_ESCAPE;
|
379 |
+
} else { // ie
|
380 |
+
escapeKey = 27;
|
381 |
+
}
|
382 |
+
|
383 |
+
var key = String.fromCharCode(keycode).toLowerCase();
|
384 |
+
|
385 |
+
if (key.match(/x|o|c/) || (keycode == escapeKey)){ // close lightbox
|
386 |
+
this.end();
|
387 |
+
} else if ((key == 'p') || (keycode == 37)){ // display previous image
|
388 |
+
if (this.activeImage != 0){
|
389 |
+
this.disableKeyboardNav();
|
390 |
+
this.changeImage(this.activeImage - 1);
|
391 |
+
}
|
392 |
+
} else if ((key == 'n') || (keycode == 39)){ // display next image
|
393 |
+
if (this.activeImage != (this.imageArray.length - 1)){
|
394 |
+
this.disableKeyboardNav();
|
395 |
+
this.changeImage(this.activeImage + 1);
|
396 |
+
}
|
397 |
+
}
|
398 |
+
},
|
399 |
+
|
400 |
+
//
|
401 |
+
// preloadNeighborImages()
|
402 |
+
// Preload previous and next images.
|
403 |
+
//
|
404 |
+
preloadNeighborImages: function(){
|
405 |
+
var preloadNextImage, preloadPrevImage;
|
406 |
+
if (this.imageArray.length > this.activeImage + 1){
|
407 |
+
preloadNextImage = new Image();
|
408 |
+
preloadNextImage.src = this.imageArray[this.activeImage + 1][0];
|
409 |
+
}
|
410 |
+
if (this.activeImage > 0){
|
411 |
+
preloadPrevImage = new Image();
|
412 |
+
preloadPrevImage.src = this.imageArray[this.activeImage - 1][0];
|
413 |
+
}
|
414 |
+
|
415 |
+
},
|
416 |
+
|
417 |
+
//
|
418 |
+
// end()
|
419 |
+
//
|
420 |
+
end: function() {
|
421 |
+
this.disableKeyboardNav();
|
422 |
+
this.lightbox.hide();
|
423 |
+
new Effect.Fade(this.overlay, { duration: this.overlayDuration });
|
424 |
+
$$('select', 'object', 'embed').each(function(node){ node.style.visibility = 'visible' });
|
425 |
+
},
|
426 |
+
|
427 |
+
//
|
428 |
+
// getPageSize()
|
429 |
+
//
|
430 |
+
getPageSize: function() {
|
431 |
+
|
432 |
+
var xScroll, yScroll;
|
433 |
+
|
434 |
+
if (window.innerHeight && window.scrollMaxY) {
|
435 |
+
xScroll = window.innerWidth + window.scrollMaxX;
|
436 |
+
yScroll = window.innerHeight + window.scrollMaxY;
|
437 |
+
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
|
438 |
+
xScroll = document.body.scrollWidth;
|
439 |
+
yScroll = document.body.scrollHeight;
|
440 |
+
} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
|
441 |
+
xScroll = document.body.offsetWidth;
|
442 |
+
yScroll = document.body.offsetHeight;
|
443 |
+
}
|
444 |
+
|
445 |
+
var windowWidth, windowHeight;
|
446 |
+
|
447 |
+
if (self.innerHeight) { // all except Explorer
|
448 |
+
if(document.documentElement.clientWidth){
|
449 |
+
windowWidth = document.documentElement.clientWidth;
|
450 |
+
} else {
|
451 |
+
windowWidth = self.innerWidth;
|
452 |
+
}
|
453 |
+
windowHeight = self.innerHeight;
|
454 |
+
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
|
455 |
+
windowWidth = document.documentElement.clientWidth;
|
456 |
+
windowHeight = document.documentElement.clientHeight;
|
457 |
+
} else if (document.body) { // other Explorers
|
458 |
+
windowWidth = document.body.clientWidth;
|
459 |
+
windowHeight = document.body.clientHeight;
|
460 |
+
}
|
461 |
+
|
462 |
+
// for small pages with total height less then height of the viewport
|
463 |
+
if(yScroll < windowHeight){
|
464 |
+
pageHeight = windowHeight;
|
465 |
+
} else {
|
466 |
+
pageHeight = yScroll;
|
467 |
+
}
|
468 |
+
|
469 |
+
// for small pages with total width less then width of the viewport
|
470 |
+
if(xScroll < windowWidth){
|
471 |
+
pageWidth = xScroll;
|
472 |
+
} else {
|
473 |
+
pageWidth = windowWidth;
|
474 |
+
}
|
475 |
+
|
476 |
+
return [pageWidth,pageHeight];
|
477 |
+
}
|
478 |
+
}
|
479 |
+
|
480 |
+
document.observe('dom:loaded', function () { new Lightbox(); });
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>VS_Featurezoom</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
@@ -19,10 +19,10 @@
|
|
19 |
<p>##############################################################################</p>
|
20 |
<p>NOTE:- For get perfect zoom result with this extension you need to spicify <strong>width</strong> and <strong>height </strong>attribut for product base image.</p></description>
|
21 |
<notes>This extension provide zoom functionality over product detail page for product images.</notes>
|
22 |
-
<authors><author><name>virendra kumar sharma</name><user>
|
23 |
-
<date>
|
24 |
-
<time>
|
25 |
-
<contents><target name="magecommunity"><dir
|
26 |
<compatible/>
|
27 |
-
<dependencies
|
28 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>VS_Featurezoom</name>
|
4 |
+
<version>1.2.1.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
19 |
<p>##############################################################################</p>
|
20 |
<p>NOTE:- For get perfect zoom result with this extension you need to spicify <strong>width</strong> and <strong>height </strong>attribut for product base image.</p></description>
|
21 |
<notes>This extension provide zoom functionality over product detail page for product images.</notes>
|
22 |
+
<authors><author><name>virendra kumar sharma</name><user>auto-converted</user><email>bhardwajveerendra@gmail.com</email></author></authors>
|
23 |
+
<date>2012-01-09</date>
|
24 |
+
<time>07:22:59</time>
|
25 |
+
<contents><target name="magecommunity"><dir name="VS"><dir name="Featurezoom"><dir name="Helper"><file name="Data.php" hash="77e3dc4cd8081d329bbadc986625c956"/></dir><dir name="Model"><file name="Magnifierpos.php" hash="56f7bc9fe220eeaabfc97e135f6cc9c2"/></dir><dir name="etc"><file name="config.xml" hash="e999af8152e01ba906280bbe8732291c"/><file name="system.xml" hash="a161cad61a873ea0ae2670a862010778"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="VS_Featurezoom.xml" hash="b1bf82a433983b29ca8651b03872edc3"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="featurezoom.xml" hash="ab86d169ba945fa6b3aef0743ff044bc"/></dir><dir name="template"><dir name="featurezoom"><file name="media.phtml" hash="055d0aa6742d12680e284093fc4c2055"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="VS"><file name="Thumbs.db" hash="a47bc5038e6d6987aee99d05d54ddcaa"/><file name="featuredimagezoomer.js" hash="e06ca70bcdd7964f3b4097f6b30561e3"/><file name="jquery-1.6.4.js" hash="c677462551f4cc0f2af192497b50f3f5"/><file name="lightbox.js" hash="c5c7c74acf9e5afe11a886a6dc0e14a8"/><file name="opc-ajax-loader.gif" hash="e805ea7eca1f34c75ba0f93780d32d38"/><file name="spinningred.gif" hash="46893b8266d278b9a81d65cdd1d8f8bf"/></dir></dir></target></contents>
|
26 |
<compatible/>
|
27 |
+
<dependencies/>
|
28 |
</package>
|