Version Notes
moved files (template/layout and skin ) to base theme
Download this release
Release Info
Developer | Magento Core Team |
Extension | CueBlocks_Zoom |
Version | 3.0.1 |
Comparing to | |
See all releases |
Code changes from version 3.0.0 to 3.0.1
- app/code/community/{JM → CueBlocks}/Zoom/Helper/Data.php +1 -1
- app/code/community/CueBlocks/Zoom/etc/config.xml +42 -0
- app/code/community/{JM → CueBlocks/Zoom}/readme.txt +2 -2
- app/code/community/JM/Zoom/etc/config.xml +0 -62
- app/design/frontend/{default → base}/default/layout/zoom.xml +26 -26
- app/design/frontend/base/default/template/zoom/media.phtml +132 -0
- app/design/frontend/default/default/template/zoom/media.phtml +0 -126
- app/etc/modules/CueBlocks_Zoom.xml +22 -0
- app/etc/modules/JM_Zoom.xml +0 -22
- js/CBjquery/Cuejqzoom.js +50 -51
- js/CBjquery/jquery.jqzoom1.0.1.js +967 -1084
- package.xml +8 -16
- skin/frontend/{default → base}/default/css/jqzoom.css +0 -0
- skin/frontend/{default → base}/default/images/zoomloader.gif +0 -0
app/code/community/{JM → CueBlocks}/Zoom/Helper/Data.php
RENAMED
@@ -7,7 +7,7 @@
|
|
7 |
* Developed By :- CueBlocks.com
|
8 |
*
|
9 |
*/
|
10 |
-
class
|
11 |
{
|
12 |
|
13 |
}
|
7 |
* Developed By :- CueBlocks.com
|
8 |
*
|
9 |
*/
|
10 |
+
class CueBlocks_Zoom_Helper_Data extends Mage_Core_Helper_Abstract
|
11 |
{
|
12 |
|
13 |
}
|
app/code/community/CueBlocks/Zoom/etc/config.xml
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
*
|
5 |
+
* Package :- CueBlocks_Zoom-1.5.tgz
|
6 |
+
* Version :- 1.5
|
7 |
+
* Edition :- Community
|
8 |
+
* Developed By :- CueBlocks.com
|
9 |
+
*
|
10 |
+
*/
|
11 |
+
-->
|
12 |
+
<config>
|
13 |
+
<modules>
|
14 |
+
<CueBlocks_Zoom>
|
15 |
+
<version>3.0.1</version>
|
16 |
+
</CueBlocks_Zoom>
|
17 |
+
</modules>
|
18 |
+
<global>
|
19 |
+
<helpers>
|
20 |
+
<cueBlocks_zoom>
|
21 |
+
<class>CueBlocks_Zoom_Helper</class>
|
22 |
+
</cueBlocks_zoom>
|
23 |
+
</helpers>
|
24 |
+
</global>
|
25 |
+
<default>
|
26 |
+
<cueBlocks_zoom>
|
27 |
+
<general>
|
28 |
+
<enabled>1</enabled>
|
29 |
+
<defaulzoom>0</defaulzoom>
|
30 |
+
</general>
|
31 |
+
</cueBlocks_zoom>
|
32 |
+
</default>
|
33 |
+
<frontend>
|
34 |
+
<layout>
|
35 |
+
<updates>
|
36 |
+
<cueBlocks_zoom>
|
37 |
+
<file>zoom.xml</file>
|
38 |
+
</cueBlocks_zoom>
|
39 |
+
</updates>
|
40 |
+
</layout>
|
41 |
+
</frontend>
|
42 |
+
</config>
|
app/code/community/{JM → CueBlocks/Zoom}/readme.txt
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
/**
|
2 |
-
* Package :- CueBlocks_Zoom-1.
|
3 |
-
* Version :- 1
|
4 |
* Edition :- Community
|
5 |
* Developed By :- CueBlocks.com
|
6 |
*
|
1 |
/**
|
2 |
+
* Package :- CueBlocks_Zoom-3.0.1.tgz
|
3 |
+
* Version :- 3.0.1
|
4 |
* Edition :- Community
|
5 |
* Developed By :- CueBlocks.com
|
6 |
*
|
app/code/community/JM/Zoom/etc/config.xml
DELETED
@@ -1,62 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<!--
|
3 |
-
/**
|
4 |
-
*
|
5 |
-
* Package :- CueBlocks_Zoom-1.5.tgz
|
6 |
-
* Version :- 1.5
|
7 |
-
* Edition :- Community
|
8 |
-
* Developed By :- CueBlocks.com
|
9 |
-
*
|
10 |
-
*/
|
11 |
-
-->
|
12 |
-
<config>
|
13 |
-
<modules>
|
14 |
-
<JM_Zoom>
|
15 |
-
<version>2.0</version>
|
16 |
-
</JM_Zoom>
|
17 |
-
</modules>
|
18 |
-
<global>
|
19 |
-
<helpers>
|
20 |
-
<zoom>
|
21 |
-
<class>JM_Zoom_Helper</class>
|
22 |
-
</zoom>
|
23 |
-
</helpers>
|
24 |
-
<resources>
|
25 |
-
<zoom_setup>
|
26 |
-
<setup>
|
27 |
-
<module>JM_Zoom</module>
|
28 |
-
</setup>
|
29 |
-
<connection>
|
30 |
-
<use>core_setup</use>
|
31 |
-
</connection>
|
32 |
-
</zoom_setup>
|
33 |
-
<zoom_write>
|
34 |
-
<connection>
|
35 |
-
<use>core_write</use>
|
36 |
-
</connection>
|
37 |
-
</zoom_write>
|
38 |
-
<zoom_read>
|
39 |
-
<connection>
|
40 |
-
<use>core_read</use>
|
41 |
-
</connection>
|
42 |
-
</zoom_read>
|
43 |
-
</resources>
|
44 |
-
</global>
|
45 |
-
<default>
|
46 |
-
<zoom>
|
47 |
-
<general>
|
48 |
-
<enabled>1</enabled>
|
49 |
-
<defaulzoom>0</defaulzoom>
|
50 |
-
</general>
|
51 |
-
</zoom>
|
52 |
-
</default>
|
53 |
-
<frontend>
|
54 |
-
<layout>
|
55 |
-
<updates>
|
56 |
-
<zoom>
|
57 |
-
<file>zoom.xml</file>
|
58 |
-
</zoom>
|
59 |
-
</updates>
|
60 |
-
</layout>
|
61 |
-
</frontend>
|
62 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/{default → base}/default/layout/zoom.xml
RENAMED
@@ -8,34 +8,34 @@
|
|
8 |
* Developed By :- CueBlocks.com
|
9 |
*
|
10 |
*/
|
11 |
-
-->
|
12 |
-
<layout version="0.1.0">
|
13 |
-
|
14 |
-
<catalog_product_view>
|
15 |
-
<reference name="head">
|
16 |
-
<action method="addItem"><type>skin_css</type><name>css/jqzoom.css</name><params/></action>
|
17 |
<action method="addJs"><script>CBjquery/jquery-1.5.2.min.js</script></action>
|
18 |
<action method="addJs"><script>CBjquery/jquery.jqzoom1.0.1.js</script></action>
|
19 |
-
<action method="addJs"><script>CBjquery/Cuejqzoom.js</script></action>
|
20 |
-
|
21 |
-
</reference>
|
22 |
-
<reference name="product.info.media">
|
23 |
-
<action method="setTemplate" ifconfig="
|
24 |
-
</reference>
|
25 |
-
</catalog_product_view>
|
26 |
-
|
27 |
-
<review_product_list>
|
28 |
-
<reference name="head">
|
29 |
-
<action method="addItem"><type>skin_css</type><name>css/jqzoom.css</name><params/></action>
|
30 |
<action method="addJs"><script>CBjquery/jquery-1.5.2.min.js</script></action>
|
31 |
-
<action method="addJs"><script>CBjquery/jquery.jqzoom1.0.1.js</script></action>
|
32 |
-
<action method="addJs"><script>CBjquery/Cuejqzoom.js</script></action>
|
33 |
-
|
34 |
-
</reference>
|
35 |
-
<reference name="product.info.media">
|
36 |
-
<action method="setTemplate" ifconfig="zoom/general/enabled"><template>zoom/media.phtml</template></action>
|
37 |
-
</reference>
|
38 |
-
</review_product_list>
|
39 |
-
|
40 |
</layout>
|
41 |
|
8 |
* Developed By :- CueBlocks.com
|
9 |
*
|
10 |
*/
|
11 |
+
-->
|
12 |
+
<layout version="0.1.0">
|
13 |
+
|
14 |
+
<catalog_product_view>
|
15 |
+
<reference name="head">
|
16 |
+
<action method="addItem"><type>skin_css</type><name>css/jqzoom.css</name><params/></action>
|
17 |
<action method="addJs"><script>CBjquery/jquery-1.5.2.min.js</script></action>
|
18 |
<action method="addJs"><script>CBjquery/jquery.jqzoom1.0.1.js</script></action>
|
19 |
+
<action method="addJs"><script>CBjquery/Cuejqzoom.js</script></action>
|
20 |
+
|
21 |
+
</reference>
|
22 |
+
<reference name="product.info.media">
|
23 |
+
<action method="setTemplate" ifconfig="cueBlocks_zoom/general/enabled"><template>zoom/media.phtml</template></action>
|
24 |
+
</reference>
|
25 |
+
</catalog_product_view>
|
26 |
+
|
27 |
+
<review_product_list>
|
28 |
+
<reference name="head">
|
29 |
+
<action method="addItem"><type>skin_css</type><name>css/jqzoom.css</name><params/></action>
|
30 |
<action method="addJs"><script>CBjquery/jquery-1.5.2.min.js</script></action>
|
31 |
+
<action method="addJs"><script>CBjquery/jquery.jqzoom1.0.1.js</script></action>
|
32 |
+
<action method="addJs"><script>CBjquery/Cuejqzoom.js</script></action>
|
33 |
+
|
34 |
+
</reference>
|
35 |
+
<reference name="product.info.media">
|
36 |
+
<action method="setTemplate" ifconfig="zoom/general/enabled"><template>zoom/media.phtml</template></action>
|
37 |
+
</reference>
|
38 |
+
</review_product_list>
|
39 |
+
|
40 |
</layout>
|
41 |
|
app/design/frontend/base/default/template/zoom/media.phtml
ADDED
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Package :- CueBlocks_Zoom-1.5.tgz
|
4 |
+
* Version :- 1.5
|
5 |
+
* Edition :- Community
|
6 |
+
* Developed By :- CueBlocks.com
|
7 |
+
*
|
8 |
+
* This file has been modified by CueBlocks.com for the Zoom function on the product page.
|
9 |
+
* If you have a custom media.phtml file,
|
10 |
+
* you will need to copy your custom code and paste it in this file.
|
11 |
+
* For help, please get in touch with us at cueblocks.com
|
12 |
+
*/
|
13 |
+
?>
|
14 |
+
|
15 |
+
<?php
|
16 |
+
$_product = $this->getProduct();
|
17 |
+
$_helper = $this->helper('catalog/output');
|
18 |
+
$_zoomConfig = Mage::getStoreConfig('zoom/general');
|
19 |
+
?>
|
20 |
+
<div id="imageShowcase">
|
21 |
+
|
22 |
+
<p class="product-image-zoom">
|
23 |
+
<?php
|
24 |
+
if ($_product->getImage() != 'no_selection' && $_product->getImage()):
|
25 |
+
|
26 |
+
$_img = '<a href="' . $this->helper('catalog/image')->init($_product, 'image') . '" class="jqzoom" title="" id="anchorproductImgDefault"><img border="0" id="productImgDefault" src="' . $this->helper('catalog/image')->init($_product, 'image')->resize(250) . '" alt="' . $this->htmlEscape($this->getImageLabel()) . '" title="' . $this->htmlEscape($this->getImageLabel()) . '"/></a>';
|
27 |
+
echo $_helper->productAttribute($_product, $_img, 'image'); else:
|
28 |
+
|
29 |
+
$_img = '<a href="' . $this->helper('catalog/image')->init($_product, 'image') . '" class="jqzoom"><img border="0" src="' . $this->helper('catalog/image')->init($_product, 'image')->resize(250) . '" alt="' . $this->htmlEscape($_product->getImageLabel()) . '" id="productImgDefault"/></a>';
|
30 |
+
echo $_helper->productAttribute($_product, $_img, 'image');
|
31 |
+
|
32 |
+
endif;
|
33 |
+
|
34 |
+
|
35 |
+
if (count($this->getGalleryImages()) > 0):
|
36 |
+
foreach ($this->getGalleryImages() as $_image):
|
37 |
+
|
38 |
+
// Find out image name from image URL
|
39 |
+
|
40 |
+
$img_name = ExtractImageName($this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()));
|
41 |
+
$_img = '<a href="' . $this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()) . '" id="anchorproductImg' . $img_name . '"><img border="0" id="productImg' . $img_name . '" src="' . $this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile())->resize(250) . '" alt="' . $this->htmlEscape($_image->getLabel()) . '" title="' . $this->htmlEscape($_image->getLabel()) . '"/></a>';
|
42 |
+
|
43 |
+
echo $_helper->productAttribute($this->getProduct(), $_img, 'image');
|
44 |
+
|
45 |
+
endforeach;
|
46 |
+
endif;
|
47 |
+
|
48 |
+
?>
|
49 |
+
|
50 |
+
</p>
|
51 |
+
<span id="roll_on">Roll on to zoom in</span>
|
52 |
+
</div>
|
53 |
+
|
54 |
+
<?php if (count($this->getGalleryImages()) > 0): ?>
|
55 |
+
|
56 |
+
<div class="more-views">
|
57 |
+
<h4><?php echo $this->__('More Views') ?></h4>
|
58 |
+
<ul>
|
59 |
+
<?php foreach ($this->getGalleryImages() as $_image):
|
60 |
+
|
61 |
+
$moreImg = ExtractImageName($this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()));
|
62 |
+
|
63 |
+
?>
|
64 |
+
<li><img border="0"
|
65 |
+
src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(56); ?>"
|
66 |
+
onclick="switchmore('<?php echo $moreImg; ?>');"
|
67 |
+
alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>"
|
68 |
+
title="<?php echo $this->htmlEscape($_image->getLabel()) ?>"/>
|
69 |
+
</li>
|
70 |
+
|
71 |
+
<?php endforeach; ?>
|
72 |
+
</ul>
|
73 |
+
</div>
|
74 |
+
|
75 |
+
<?php endif; ?>
|
76 |
+
|
77 |
+
<?php
|
78 |
+
// PHP FUNCTION
|
79 |
+
|
80 |
+
function ExtractImageName($fullImagePath)
|
81 |
+
{
|
82 |
+
$img_extract = explode("/", $fullImagePath);
|
83 |
+
$img_Len = count($img_extract);
|
84 |
+
$fullImgName = $img_extract[$img_Len - 1]; // Image name from full path
|
85 |
+
$fullImgName_extract = explode(".", $fullImgName);
|
86 |
+
$ImgName = $fullImgName_extract[0];
|
87 |
+
return $ImgName;
|
88 |
+
}
|
89 |
+
|
90 |
+
?>
|
91 |
+
<script type="text/javascript">
|
92 |
+
|
93 |
+
jQuery(document).ready(function () {
|
94 |
+
|
95 |
+
var options = {
|
96 |
+
|
97 |
+
zoomWidth: 250,
|
98 |
+
|
99 |
+
zoomHeight: 250,
|
100 |
+
|
101 |
+
showEffect: 'show',
|
102 |
+
|
103 |
+
hideEffect: 'fadeout',
|
104 |
+
|
105 |
+
fadeoutSpeed: 'slow',
|
106 |
+
|
107 |
+
title: false,
|
108 |
+
|
109 |
+
zoomtype: 'innerzoom',
|
110 |
+
|
111 |
+
showPreload: false,
|
112 |
+
|
113 |
+
yOffset: 70
|
114 |
+
|
115 |
+
}
|
116 |
+
|
117 |
+
|
118 |
+
jQuery(".jqzoom").jqzoom(options);
|
119 |
+
|
120 |
+
});
|
121 |
+
|
122 |
+
</script>
|
123 |
+
<script type="text/javascript">
|
124 |
+
// show main image
|
125 |
+
jQuery(document).ready(function () {
|
126 |
+
|
127 |
+
// On document ready hide all images first
|
128 |
+
jQuery("#imageShowcase img").hide();
|
129 |
+
jQuery("#productImgDefault").show();
|
130 |
+
|
131 |
+
});
|
132 |
+
</script>
|
app/design/frontend/default/default/template/zoom/media.phtml
DELETED
@@ -1,126 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Package :- CueBlocks_Zoom-1.5.tgz
|
4 |
-
* Version :- 1.5
|
5 |
-
* Edition :- Community
|
6 |
-
* Developed By :- CueBlocks.com
|
7 |
-
*
|
8 |
-
* This file has been modified by CueBlocks.com for the Zoom function on the product page.
|
9 |
-
* If you have a custom media.phtml file,
|
10 |
-
* you will need to copy your custom code and paste it in this file.
|
11 |
-
* For help, please get in touch with us at cueblocks.com
|
12 |
-
*/
|
13 |
-
?>
|
14 |
-
|
15 |
-
<?php
|
16 |
-
$_product = $this->getProduct();
|
17 |
-
$_helper = $this->helper('catalog/output');
|
18 |
-
$_zoomConfig = Mage::getStoreConfig('zoom/general');
|
19 |
-
?>
|
20 |
-
<div id="imageShowcase">
|
21 |
-
|
22 |
-
<p class="product-image-zoom">
|
23 |
-
<?php
|
24 |
-
if ($_product->getImage() != 'no_selection' && $_product->getImage()):
|
25 |
-
|
26 |
-
$_img = '<a href="'.$this->helper('catalog/image')->init($_product, 'image').'" class="jqzoom" title="" id="anchorproductImgDefault"><img border="0" id="productImgDefault" src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(250).'" alt="'.$this->htmlEscape($this->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'"/></a>';
|
27 |
-
echo $_helper->productAttribute($_product, $_img, 'image');
|
28 |
-
|
29 |
-
else:
|
30 |
-
|
31 |
-
$_img = '<a href="'.$this->helper('catalog/image')->init($_product, 'image').'" class="jqzoom"><img border="0" src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(250).'" alt="'.$this->htmlEscape($_product->getImageLabel()).'" id="productImgDefault"/></a>';
|
32 |
-
echo $_helper->productAttribute($_product, $_img, 'image');
|
33 |
-
|
34 |
-
endif;
|
35 |
-
|
36 |
-
|
37 |
-
if (count($this->getGalleryImages()) > 0):
|
38 |
-
foreach ($this->getGalleryImages() as $_image):
|
39 |
-
|
40 |
-
// Find out image name from image URL
|
41 |
-
|
42 |
-
$img_name = ExtractImageName($this->helper('catalog/image')->init($this->getProduct(), 'image',$_image->getFile()));
|
43 |
-
$_img = '<a href="'.$this->helper('catalog/image')->init($this->getProduct(), 'image',$_image->getFile()).'" id="anchorproductImg'.$img_name.'"><img border="0" id="productImg'.$img_name.'" src="'.$this->helper('catalog/image')->init($this->getProduct(), 'image',$_image->getFile())->resize(250).'" alt="'.$this->htmlEscape($_image->getLabel()).'" title="'.$this->htmlEscape($_image->getLabel()).'"/></a>';
|
44 |
-
|
45 |
-
echo $_helper->productAttribute($this->getProduct(), $_img, 'image');
|
46 |
-
|
47 |
-
endforeach;
|
48 |
-
endif;
|
49 |
-
|
50 |
-
?>
|
51 |
-
|
52 |
-
</p>
|
53 |
-
<span id="roll_on">Roll on to zoom in</span>
|
54 |
-
</div>
|
55 |
-
|
56 |
-
<?php if (count($this->getGalleryImages()) > 0): ?>
|
57 |
-
|
58 |
-
<div class="more-views">
|
59 |
-
<h4><?php echo $this->__('More Views') ?></h4>
|
60 |
-
<ul>
|
61 |
-
<?php foreach ($this->getGalleryImages() as $_image):
|
62 |
-
$moreImg = ExtractImageName($this->helper('catalog/image')->init($this->getProduct(), 'image',$_image->getFile()));
|
63 |
-
?>
|
64 |
-
<li><img border="0" src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(56); ?>" onclick="switchmore('<?php echo $moreImg;?>');" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>" />
|
65 |
-
</li>
|
66 |
-
|
67 |
-
<?php endforeach; ?>
|
68 |
-
</ul>
|
69 |
-
</div>
|
70 |
-
|
71 |
-
<?php endif; ?>
|
72 |
-
|
73 |
-
<?php
|
74 |
-
// PHP FUNCTION
|
75 |
-
|
76 |
-
function ExtractImageName($fullImagePath)
|
77 |
-
{
|
78 |
-
$img_extract = explode("/",$fullImagePath);
|
79 |
-
$img_Len = count($img_extract);
|
80 |
-
$fullImgName = $img_extract[$img_Len-1]; // Image name from full path
|
81 |
-
$fullImgName_extract = explode(".",$fullImgName);
|
82 |
-
$ImgName = $fullImgName_extract[0];
|
83 |
-
return $ImgName;
|
84 |
-
}
|
85 |
-
|
86 |
-
?>
|
87 |
-
|
88 |
-
jQuery(document).ready(function(){
|
89 |
-
|
90 |
-
var options = {
|
91 |
-
|
92 |
-
zoomWidth: 250,
|
93 |
-
|
94 |
-
zoomHeight: 250,
|
95 |
-
|
96 |
-
showEffect: 'show',
|
97 |
-
|
98 |
-
hideEffect: 'fadeout',
|
99 |
-
|
100 |
-
fadeoutSpeed: 'slow',
|
101 |
-
|
102 |
-
title: false,
|
103 |
-
|
104 |
-
zoomtype:'innerzoom',
|
105 |
-
|
106 |
-
showPreload: false,
|
107 |
-
|
108 |
-
yOffset: 70
|
109 |
-
|
110 |
-
}
|
111 |
-
|
112 |
-
jQuery(".jqzoom").jqzoom(options);
|
113 |
-
|
114 |
-
});
|
115 |
-
|
116 |
-
</script>
|
117 |
-
<script type="text/javascript">
|
118 |
-
// show main image
|
119 |
-
jQuery(document).ready(function() {
|
120 |
-
|
121 |
-
// On document ready hide all images first
|
122 |
-
jQuery("#imageShowcase img").hide();
|
123 |
-
jQuery("#productImgDefault").show();
|
124 |
-
|
125 |
-
});
|
126 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/etc/modules/CueBlocks_Zoom.xml
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
*
|
5 |
+
* Package :- CueBlocks_Zoom-1.5.tgz
|
6 |
+
* Version :- 1.5
|
7 |
+
* Edition :- Community
|
8 |
+
* Developed By :- CueBlocks.com
|
9 |
+
*
|
10 |
+
*/
|
11 |
+
-->
|
12 |
+
<config>
|
13 |
+
<modules>
|
14 |
+
<CueBlocks_Zoom>
|
15 |
+
<active>true</active>
|
16 |
+
<codePool>community</codePool>
|
17 |
+
<depends>
|
18 |
+
<Mage_Catalog/>
|
19 |
+
</depends>
|
20 |
+
</CueBlocks_Zoom>
|
21 |
+
</modules>
|
22 |
+
</config>
|
app/etc/modules/JM_Zoom.xml
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<!--
|
3 |
-
/**
|
4 |
-
*
|
5 |
-
* Package :- CueBlocks_Zoom-1.5.tgz
|
6 |
-
* Version :- 1.5
|
7 |
-
* Edition :- Community
|
8 |
-
* Developed By :- CueBlocks.com
|
9 |
-
*
|
10 |
-
*/
|
11 |
-
-->
|
12 |
-
<config>
|
13 |
-
<modules>
|
14 |
-
<JM_Zoom>
|
15 |
-
<active>true</active>
|
16 |
-
<codePool>community</codePool>
|
17 |
-
<depends>
|
18 |
-
<Mage_Catalog />
|
19 |
-
</depends>
|
20 |
-
</JM_Zoom>
|
21 |
-
</modules>
|
22 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/CBjquery/Cuejqzoom.js
CHANGED
@@ -1,53 +1,52 @@
|
|
1 |
-
/* :- CueBlocks_Zoom-1.5.tgz
|
2 |
-
* Version :- 1.5
|
3 |
-
* Edition :- Community
|
4 |
-
* Developed By :- CueBlocks.com
|
5 |
-
*
|
6 |
-
*/
|
7 |
-
var zoomDone = new Array();
|
8 |
// SWITCH MAIN IMAGE BASED ON MORE IMAGES ON MEDIA FILE
|
9 |
-
function switchmore(imagename){
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
-
//IN ARRAY FUNCTION
|
43 |
-
Array.prototype.in_array = function(p_val) {
|
44 |
-
for(var i = 0, l = this.length; i < l; i++) {
|
45 |
-
if(this[i] == p_val) {
|
46 |
-
return true;
|
47 |
-
}
|
48 |
-
}
|
49 |
-
return false;
|
50 |
-
}
|
51 |
-
|
52 |
-
|
53 |
-
|
1 |
+
/* :- CueBlocks_Zoom-1.5.tgz
|
2 |
+
* Version :- 1.5
|
3 |
+
* Edition :- Community
|
4 |
+
* Developed By :- CueBlocks.com
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
var zoomDone = new Array();
|
8 |
// SWITCH MAIN IMAGE BASED ON MORE IMAGES ON MEDIA FILE
|
9 |
+
function switchmore(imagename) {
|
10 |
+
jQuery("#imageShowcase a").hide();
|
11 |
+
jQuery("#productImg" + imagename).show();
|
12 |
+
jQuery("#anchorproductImg" + imagename).attr("style", "display:block");
|
13 |
+
var options = {
|
14 |
+
|
15 |
+
zoomWidth: 250,
|
16 |
+
|
17 |
+
zoomHeight: 250,
|
18 |
+
|
19 |
+
showEffect: 'show',
|
20 |
+
|
21 |
+
hideEffect: 'fadeout',
|
22 |
+
|
23 |
+
fadeoutSpeed: 'slow',
|
24 |
+
|
25 |
+
title: false,
|
26 |
+
|
27 |
+
zoomtype: 'innerzoom',
|
28 |
+
|
29 |
+
|
30 |
+
yOffset: 70
|
31 |
+
|
32 |
+
}
|
33 |
+
|
34 |
+
if (!zoomDone.in_array(imagename)) {
|
35 |
+
jQuery("#anchorproductImg" + imagename).jqzoom(options);
|
36 |
+
zoomDone.push(imagename);
|
37 |
+
}
|
38 |
+
|
39 |
+
}
|
40 |
+
|
41 |
+
//IN ARRAY FUNCTION
|
42 |
+
Array.prototype.in_array = function (p_val) {
|
43 |
+
for (var i = 0, l = this.length; i < l; i++) {
|
44 |
+
if (this[i] == p_val) {
|
45 |
+
return true;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
return false;
|
49 |
+
}
|
50 |
+
|
51 |
+
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/CBjquery/jquery.jqzoom1.0.1.js
CHANGED
@@ -9,1135 +9,1018 @@
|
|
9 |
*
|
10 |
* $License : GPL,so any change to the code you should copy and paste this section,and would be nice to report this to me(renzi.mrc@gmail.com).
|
11 |
*/
|
12 |
-
(function($)
|
13 |
-
{
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
var settings = {
|
19 |
zoomType: 'standard', //standard/reverse/innerzoom
|
20 |
zoomWidth: 200, //zoomed width default width
|
21 |
zoomHeight: 200, //zoomed div default width
|
22 |
xOffset: 10, //zoomed div default offset
|
23 |
yOffset: 0,
|
24 |
-
position: "right"
|
25 |
-
lens:true, //zooming lens over the image,by default is 1;
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
};
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
$(a).css('outline-style','none');
|
51 |
-
|
52 |
-
|
53 |
-
var img = $("img", this);
|
54 |
-
var imageTitle = img.attr('title');
|
55 |
-
img.removeAttr('title'); //variabile per memorizzare il titolo immagine
|
56 |
-
|
57 |
-
var smallimage = new Smallimage( img );
|
58 |
-
var smallimagedata = {};
|
59 |
-
//imageborder
|
60 |
-
var btop = 0;
|
61 |
-
var bleft = 0;
|
62 |
-
|
63 |
-
var loader = null; //variabile per memorizzare oggetto loader
|
64 |
-
loader = new Loader();
|
65 |
-
|
66 |
-
var ZoomTitle = (trim(aTitle).length > 0) ? aTitle :
|
67 |
-
(trim(imageTitle).length > 0) ? imageTitle : null; //setting zoomtitle
|
68 |
-
var ZoomTitleObj = new zoomTitle();
|
69 |
-
|
70 |
-
var largeimage = new Largeimage( a[0].href );
|
71 |
-
|
72 |
-
var lens = new Lens();
|
73 |
-
var lensdata = {};
|
74 |
-
//lensborder
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
var largeimageloaded = false;
|
79 |
-
var scale = {}; //rapporto tra immagine grande e piccola scale.x/scale.y
|
80 |
-
var stage = null; // quadrato che mostra l'immagine ingrandita
|
81 |
-
var running = false; // running = true quando si verifica l'evento che mostra lo zoom(adesso mouseover).
|
82 |
-
var mousepos = {};
|
83 |
-
var firstime = 0;
|
84 |
-
var preloadshow = false;
|
85 |
-
var isMouseDown = false;
|
86 |
-
var dragstatus = false
|
87 |
-
//loading smallimagedata
|
88 |
-
smallimage.loadimage();
|
89 |
-
|
90 |
-
//ritorna false al click dell href
|
91 |
-
$(this).click(function(){return false;});
|
92 |
-
|
93 |
-
//se settato alwaysOn attivo lo Zoom e lo mostro.
|
94 |
-
|
95 |
-
//attivo al mouseover
|
96 |
-
$(this).hover(function(e)
|
97 |
-
{
|
98 |
-
mousepos.x = e.pageX;
|
99 |
-
mousepos.y = e.pageY;
|
100 |
-
activate();
|
101 |
-
},function()
|
102 |
-
{
|
103 |
-
deactivate();
|
104 |
-
});
|
105 |
-
|
106 |
-
|
107 |
-
//ALWAYS ON
|
108 |
-
if(settings.alwaysOn)
|
109 |
-
{
|
110 |
-
setTimeout(function(){activate();},150);
|
111 |
-
}
|
112 |
-
|
113 |
-
|
114 |
-
function activate()
|
115 |
-
{
|
116 |
-
|
117 |
-
if ( !running ) {
|
118 |
-
|
119 |
-
//finding border
|
120 |
-
smallimage.findborder();
|
121 |
-
|
122 |
-
running = true;
|
123 |
-
|
124 |
-
//rimuovo il titolo al mouseover
|
125 |
-
imageTitle = img.attr('title');
|
126 |
-
img.removeAttr('title');
|
127 |
-
aTitle = a.attr('title');
|
128 |
-
$(a).removeAttr('title');
|
129 |
-
|
130 |
-
//se non c� creo l'oggetto largeimage
|
131 |
-
if (!largeimage || $.browser.safari) {
|
132 |
-
largeimage = new Largeimage( a[0].href );
|
133 |
-
}
|
134 |
-
|
135 |
-
//se l'immagine grande non � stata caricata la carico
|
136 |
-
if(!largeimageloaded || $.browser.safari)
|
137 |
-
{
|
138 |
-
largeimage.loadimage();
|
139 |
-
}else
|
140 |
-
{
|
141 |
-
//after preload
|
142 |
-
if(settings.zoomType != 'innerzoom')
|
143 |
-
{
|
144 |
-
stage = new Stage();
|
145 |
-
stage.activate();
|
146 |
-
}
|
147 |
-
lens = new Lens;
|
148 |
-
lens.activate();
|
149 |
-
}
|
150 |
-
|
151 |
-
//hack per MAC
|
152 |
-
/* if($.browser.safari)
|
153 |
-
{
|
154 |
-
if(settings.zoomType != 'innerzoom') //se innerzoom non mostro la finestra dello zoom
|
155 |
-
{
|
156 |
-
stage = new Stage();
|
157 |
-
stage.activate();
|
158 |
-
}
|
159 |
-
if($('div.jqZoomPup').length <= 0)
|
160 |
-
{
|
161 |
-
lens = new Lens();
|
162 |
-
}
|
163 |
-
//if(settings.zoomType == 'innerzoom'){lens = new Lens()};
|
164 |
-
lens.activate();
|
165 |
-
(settings.alwaysOn) ? lens.center() : lens.setposition(null);
|
166 |
-
}
|
167 |
-
*/
|
168 |
-
a[0].blur();
|
169 |
-
//alert($('div.jqZoomPup').length);
|
170 |
-
return false;
|
171 |
-
}
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
}
|
177 |
-
|
178 |
-
function deactivate()
|
179 |
-
{
|
180 |
-
if(settings.zoomType == 'reverse' && !settings.alwaysOn)
|
181 |
-
{
|
182 |
-
img.css({'opacity' : 1});
|
183 |
-
}
|
184 |
-
|
185 |
-
if(!settings.alwaysOn)
|
186 |
-
{
|
187 |
-
//resetting parameters
|
188 |
-
running = false;
|
189 |
-
largeimageloaded = false;
|
190 |
-
$(lens.node).unbind('mousemove');
|
191 |
-
lens.remove();
|
192 |
-
if($('div.jqZoomWindow').length >0)
|
193 |
-
{
|
194 |
-
stage.remove();
|
195 |
-
}
|
196 |
-
if($('div.jqZoomTitle').length > 0)
|
197 |
-
{
|
198 |
-
ZoomTitleObj.remove();
|
199 |
-
}
|
200 |
-
//resetting title
|
201 |
-
img.attr('title',imageTitle);
|
202 |
-
a.attr('title',aTitle);
|
203 |
-
$().unbind();
|
204 |
-
|
205 |
-
a.unbind('mousemove');
|
206 |
-
//resetto il parametro che mi dice che � la prima volta che mostor lo zoom
|
207 |
-
firstime = 0;
|
208 |
-
//remove ieiframe
|
209 |
-
if(jQuery('.zoom_ieframe').length > 0)
|
210 |
-
{
|
211 |
-
jQuery('.zoom_ieframe').remove();
|
212 |
-
}
|
213 |
-
}else
|
214 |
-
{
|
215 |
-
if(settings.lensReset)
|
216 |
-
{
|
217 |
-
switch(settings.zoomType)
|
218 |
-
{
|
219 |
-
case 'innerzoom':
|
220 |
-
largeimage.setcenter();
|
221 |
-
break;
|
222 |
-
default:
|
223 |
-
lens.center();
|
224 |
-
break;
|
225 |
-
}
|
226 |
-
}
|
227 |
-
}
|
228 |
-
|
229 |
-
//non so se serve da provare
|
230 |
-
if(settings.alwaysOn)
|
231 |
-
{
|
232 |
-
activate();
|
233 |
-
}
|
234 |
-
};
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
//smallimage
|
241 |
-
function Smallimage( image )
|
242 |
-
{
|
243 |
-
this.node = image[0];
|
244 |
-
|
245 |
-
this.loadimage = function() {
|
246 |
-
this.node.src = image[0].src;
|
247 |
-
if (typeof smallimagedata.top === "undefined") {
|
248 |
-
this.node.onload();
|
249 |
-
}
|
250 |
-
|
251 |
-
};
|
252 |
-
|
253 |
-
this.findborder = function()
|
254 |
-
{
|
255 |
-
var bordertop = '';
|
256 |
-
bordertop = $(img).css('border-top-width');
|
257 |
-
btop = '';
|
258 |
-
var borderleft = '';
|
259 |
-
borderleft = $(img).css('border-left-width');
|
260 |
-
bleft = '';
|
261 |
-
/*if($.browser.msie)
|
262 |
-
{
|
263 |
-
var temp = bordertop.split(' ');
|
264 |
-
|
265 |
-
bordertop = temp[1];
|
266 |
-
var temp = borderleft.split(' ');
|
267 |
-
borderleft = temp[1];
|
268 |
-
}*/
|
269 |
-
|
270 |
-
if(bordertop)
|
271 |
-
{
|
272 |
-
for(i=0;i<3;i++)
|
273 |
-
{
|
274 |
-
var x = [];
|
275 |
-
x = bordertop.substr(i,1);
|
276 |
-
|
277 |
-
if(isNaN(x) == false)
|
278 |
-
{
|
279 |
-
btop = btop +''+ bordertop.substr(i,1);
|
280 |
-
}else
|
281 |
-
{
|
282 |
-
break;
|
283 |
-
}
|
284 |
-
}
|
285 |
-
}
|
286 |
-
|
287 |
-
if(borderleft)
|
288 |
-
{
|
289 |
-
for(i=0;i<3;i++)
|
290 |
-
{
|
291 |
-
if(!isNaN(borderleft.substr(i,1)))
|
292 |
-
{
|
293 |
-
bleft = bleft + borderleft.substr(i,1)
|
294 |
-
}else
|
295 |
-
{
|
296 |
-
break;
|
297 |
-
}
|
298 |
-
}
|
299 |
-
}
|
300 |
-
btop = (btop.length > 0) ? eval(btop) : 0;
|
301 |
-
bleft = (bleft.length > 0) ? eval(bleft) : 0;
|
302 |
-
|
303 |
-
|
304 |
-
}
|
305 |
-
|
306 |
-
|
307 |
-
this.node.onload = function()
|
308 |
-
{
|
309 |
-
//setto il cursor e la posizione dell'href
|
310 |
-
|
311 |
-
|
312 |
-
a.css({'cursor':'crosshair','display':'block'});
|
313 |
-
|
314 |
-
if(a.css('position')!= 'absolute' && a.parent().css('position'))
|
315 |
-
{
|
316 |
-
a.css({'cursor':'crosshair','position':'relative','display':'block'});
|
317 |
-
}
|
318 |
-
if(a.parent().css('position') != 'absolute')
|
319 |
-
{
|
320 |
-
a.parent().css('position','relative');
|
321 |
-
//a.css('position','relative');
|
322 |
-
}
|
323 |
-
else{
|
324 |
-
//a.css('position','relative');
|
325 |
-
}
|
326 |
-
if($.browser.safari || $.browser.opera)
|
327 |
-
{
|
328 |
-
$(img).css({position:'absolute',top:'0px',left:'0px'});
|
329 |
-
}
|
330 |
-
/*if(a.css('position')!= 'absolute' && a.parent().css('position'))
|
331 |
-
{
|
332 |
-
a.css({'cursor':'crosshair','position':'relative','display':'block'});
|
333 |
-
}
|
334 |
-
if(a.parent().css('position') != 'absolute')
|
335 |
-
{
|
336 |
-
alert('in');
|
337 |
-
a.parent().css('position','relative');
|
338 |
-
//a.css('position','relative');
|
339 |
-
}
|
340 |
-
else{
|
341 |
-
//a.css('position','relative');
|
342 |
-
}*/
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
/*
|
347 |
-
if(a.parent().css('position') != 'relative' && a.css('position') != 'absolute')
|
348 |
-
{
|
349 |
-
a.css({'cursor':'crosshair','position':'relative','display':'block'});
|
350 |
-
}*/
|
351 |
-
|
352 |
-
//al docuemnt ready viene caricato l'src quindi viene azionato l'onload e carico tutti i dati
|
353 |
-
smallimagedata.w = $( this ).width();
|
354 |
-
smallimagedata.h = $( this ).height();
|
355 |
-
|
356 |
-
|
357 |
-
//non viene fatta assegnazione alla variabile globale
|
358 |
-
smallimagedata.h = $( this ).height();
|
359 |
-
smallimagedata.pos = $( this ).offset();
|
360 |
-
smallimagedata.pos.l = $( this ).offset().left;
|
361 |
-
smallimagedata.pos.t = $( this ).offset().top;
|
362 |
-
smallimagedata.pos.r = smallimagedata.w + smallimagedata.pos.l;
|
363 |
-
smallimagedata.pos.b = smallimagedata.h + smallimagedata.pos.t;
|
364 |
-
|
365 |
-
//per sicurezza setto l'altezza e la width dell'href
|
366 |
-
a.height(smallimagedata.h);
|
367 |
-
a.width(smallimagedata.w);
|
368 |
-
|
369 |
-
|
370 |
-
//PRELOAD IMAGES
|
371 |
-
if(settings.preloadImages)
|
372 |
-
{
|
373 |
-
largeimage.loadimage();
|
374 |
-
}
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
};
|
379 |
-
|
380 |
-
|
381 |
-
return this;
|
382 |
-
};
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
//Lens
|
389 |
-
function Lens()
|
390 |
-
{
|
391 |
-
|
392 |
-
|
393 |
-
//creating element and adding class
|
394 |
-
this.node = document.createElement("div");
|
395 |
-
$(this.node).addClass('jqZoomPup');
|
396 |
-
|
397 |
-
this.node.onerror = function() {
|
398 |
-
$( lens.node ).remove();
|
399 |
-
lens = new Lens();
|
400 |
-
lens.activate() ;
|
401 |
-
};
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
//funzione privata per il caricamento dello zoom
|
407 |
-
this.loadlens = function()
|
408 |
-
{
|
409 |
-
|
410 |
-
|
411 |
-
switch(settings.zoomType)
|
412 |
-
{
|
413 |
-
case 'reverse':
|
414 |
-
this.image = new Image();
|
415 |
-
this.image.src = smallimage.node.src; // fires off async
|
416 |
-
this.node.appendChild( this.image );
|
417 |
-
$( this.node ).css({'opacity' : 1});
|
418 |
-
break;
|
419 |
-
case 'innerzoom':
|
420 |
-
|
421 |
-
this.image = new Image();
|
422 |
-
this.image.src = largeimage.node.src; // fires off async
|
423 |
-
this.node.appendChild( this.image );
|
424 |
-
$( this.node ).css({'opacity' : 1});
|
425 |
-
break
|
426 |
-
default:
|
427 |
-
break;
|
428 |
-
}
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
switch(settings.zoomType)
|
433 |
-
{
|
434 |
-
case 'innerzoom':
|
435 |
-
lensdata.w = smallimagedata.w;
|
436 |
-
lensdata.h = smallimagedata.h;
|
437 |
-
break;
|
438 |
-
default:
|
439 |
-
lensdata.w = (settings.zoomWidth)/scale.x;
|
440 |
-
lensdata.h = (settings.zoomHeight)/scale.y;
|
441 |
-
break;
|
442 |
-
}
|
443 |
-
|
444 |
-
$( this.node ).css({
|
445 |
-
width: lensdata.w + 'px',
|
446 |
-
height: lensdata.h + 'px',
|
447 |
-
position: 'absolute',
|
448 |
-
/*cursor: 'crosshair',*/
|
449 |
-
display: 'none',
|
450 |
-
//border: '1px solid blue'
|
451 |
-
borderWidth: 1+'px'
|
452 |
-
});
|
453 |
-
a.append(this.node);
|
454 |
-
}
|
455 |
-
return this;
|
456 |
-
};
|
457 |
-
|
458 |
-
Lens.prototype.activate = function()
|
459 |
-
{
|
460 |
-
//carico la lente
|
461 |
-
this.loadlens();
|
462 |
-
|
463 |
-
switch(settings.zoomType)
|
464 |
-
{
|
465 |
-
case 'reverse':
|
466 |
-
img.css({'opacity' : settings.imageOpacity});
|
467 |
-
|
468 |
-
(settings.alwaysOn) ? lens.center() : lens.setposition(null);
|
469 |
-
//lens.center();
|
470 |
-
//bindo ad a il mousemove della lente
|
471 |
-
a.bind( 'mousemove', function(e)
|
472 |
-
{
|
473 |
-
mousepos.x = e.pageX;
|
474 |
-
mousepos.y = e.pageY;
|
475 |
-
lens.setposition( e );
|
476 |
-
});
|
477 |
-
break;
|
478 |
-
case 'innerzoom':
|
479 |
-
|
480 |
-
// lens = new Lens();
|
481 |
-
// lens.activate();
|
482 |
-
|
483 |
-
$( this.node ).css({top : 0 ,left: 0});
|
484 |
-
if(settings.title)
|
485 |
-
{
|
486 |
-
ZoomTitleObj.loadtitle();
|
487 |
-
}
|
488 |
-
|
489 |
-
largeimage.setcenter();
|
490 |
-
|
491 |
-
a.bind( 'mousemove', function(e)
|
492 |
-
{
|
493 |
-
mousepos.x = e.pageX;
|
494 |
-
mousepos.y = e.pageY;
|
495 |
-
largeimage.setinner( e );
|
496 |
-
|
497 |
-
/*if(settings.zoomType == 'innerzoom' && running)
|
498 |
-
{
|
499 |
-
$(a).mousemove(function(){
|
500 |
-
if($('div.jqZoomPup').length <= 0)
|
501 |
-
{
|
502 |
-
lens = new Lens();
|
503 |
-
lens.activate();
|
504 |
-
}
|
505 |
-
});
|
506 |
-
}*/
|
507 |
-
|
508 |
-
/*if($('div.jqZoomPup').length <= 0)
|
509 |
-
{
|
510 |
-
lens = new Lens();
|
511 |
-
lens.activate();
|
512 |
-
}*/
|
513 |
-
|
514 |
-
});
|
515 |
-
break;
|
516 |
-
default:
|
517 |
-
/*$(document).mousemove(function(e){
|
518 |
-
if(isMouseDown && dragstatus != false){
|
519 |
-
lens.setposition( e );
|
520 |
-
}
|
521 |
-
});
|
522 |
-
lens.center()
|
523 |
-
|
524 |
-
|
525 |
-
dragstatus = 'on'
|
526 |
-
$(document).mouseup(function(e){
|
527 |
-
if(isMouseDown && dragstatus != false){
|
528 |
-
isMouseDown = false;
|
529 |
-
dragstatus = false;
|
530 |
-
|
531 |
-
}
|
532 |
-
});
|
533 |
-
|
534 |
-
$(this.node).mousedown(function(e){
|
535 |
-
$('div.jqZoomPup').css("cursor", "move");
|
536 |
-
$(this.node).css("position", "absolute");
|
537 |
-
|
538 |
-
// set z-index
|
539 |
-
$(this.node).css("z-index", parseInt( new Date().getTime()/1000 ));
|
540 |
-
if($.browser.safari)
|
541 |
-
{
|
542 |
-
$(a).css("cursor", "move");
|
543 |
-
}
|
544 |
-
isMouseDown = true;
|
545 |
-
dragstatus = 'on';
|
546 |
-
lens.setposition( e );
|
547 |
-
});
|
548 |
-
*/
|
549 |
-
|
550 |
-
|
551 |
-
(settings.alwaysOn) ? lens.center() : lens.setposition(null);
|
552 |
-
|
553 |
-
//bindo ad a il mousemove della lente
|
554 |
-
$(a).bind( 'mousemove', function(e)
|
555 |
-
{
|
556 |
-
|
557 |
-
mousepos.x = e.pageX;
|
558 |
-
mousepos.y = e.pageY;
|
559 |
-
lens.setposition( e );
|
560 |
-
});
|
561 |
-
|
562 |
-
break;
|
563 |
-
}
|
564 |
-
|
565 |
-
|
566 |
-
return this;
|
567 |
-
};
|
568 |
-
|
569 |
-
Lens.prototype.setposition = function( e)
|
570 |
-
{
|
571 |
-
|
572 |
-
|
573 |
-
if(e)
|
574 |
-
{
|
575 |
-
mousepos.x = e.pageX;
|
576 |
-
mousepos.y = e.pageY;
|
577 |
-
}
|
578 |
-
|
579 |
-
if(firstime == 0)
|
580 |
-
{
|
581 |
-
var lensleft = (smallimagedata.w)/2 - (lensdata.w)/2 ;
|
582 |
-
var lenstop = (smallimagedata.h)/2 - (lensdata.h)/2 ;
|
583 |
-
//ADDED
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
$('div.jqZoomPup').show()
|
589 |
-
if(settings.lens)
|
590 |
-
{
|
591 |
-
this.node.style.visibility = 'visible';
|
592 |
-
document.getElementById("roll_on").innerHTML = "Roll off to zoom out";
|
593 |
-
}
|
594 |
-
else
|
595 |
-
{
|
596 |
-
this.node.style.visibility = 'hidden';
|
597 |
-
document.getElementById("roll_on").innerHTML = "Roll on to zoom in";
|
598 |
-
$('div.jqZoomPup').hide();
|
599 |
-
|
600 |
-
}
|
601 |
-
//ADDED
|
602 |
-
firstime = 1;
|
603 |
-
|
604 |
-
}else
|
605 |
-
{
|
606 |
-
var lensleft = mousepos.x - smallimagedata.pos.l - (lensdata.w)/2 ;
|
607 |
-
var lenstop = mousepos.y - smallimagedata.pos.t -(lensdata.h)/2 ;
|
608 |
-
}
|
609 |
-
|
610 |
-
|
611 |
-
//a sinistra
|
612 |
-
if(overleft())
|
613 |
-
{
|
614 |
-
lensleft = 0 + bleft;
|
615 |
-
}else
|
616 |
-
//a destra
|
617 |
-
if(overright())
|
618 |
-
{
|
619 |
-
if($.browser.msie)
|
620 |
-
{
|
621 |
-
lensleft = smallimagedata.w - lensdata.w + bleft + 1 ;
|
622 |
-
}else
|
623 |
-
{
|
624 |
-
lensleft = smallimagedata.w - lensdata.w + bleft - 1 ;
|
625 |
-
}
|
626 |
-
|
627 |
-
|
628 |
-
}
|
629 |
-
|
630 |
-
//in alto
|
631 |
-
if(overtop())
|
632 |
-
{
|
633 |
-
lenstop = 0 + btop ;
|
634 |
-
}else
|
635 |
-
//sotto
|
636 |
-
if(overbottom())
|
637 |
-
{
|
638 |
-
|
639 |
-
if($.browser.msie)
|
640 |
-
{
|
641 |
-
lenstop = smallimagedata.h - lensdata.h + btop + 1 ;
|
642 |
-
}else
|
643 |
-
{
|
644 |
-
lenstop = smallimagedata.h - lensdata.h - 1 + btop ;
|
645 |
-
}
|
646 |
-
|
647 |
-
}
|
648 |
-
lensleft = parseInt(lensleft);
|
649 |
-
lenstop = parseInt(lenstop);
|
650 |
-
|
651 |
-
//setto lo zoom ed un eventuale immagine al centro
|
652 |
-
$('div.jqZoomPup',a).css({top: lenstop,left: lensleft });
|
653 |
-
|
654 |
-
if(settings.zoomType == 'reverse')
|
655 |
-
{
|
656 |
-
$('div.jqZoomPup img',a).css({'position': 'absolute','top': -( lenstop - btop +1) ,'left': -(lensleft - bleft +1) });
|
657 |
-
}
|
658 |
-
|
659 |
-
this.node.style.left = lensleft + 'px';
|
660 |
-
this.node.style.top = lenstop + 'px';
|
661 |
-
|
662 |
-
//setto l'immagine grande
|
663 |
-
largeimage.setposition();
|
664 |
-
|
665 |
-
function overleft() {
|
666 |
-
return mousepos.x - (lensdata.w +2*1)/2 - bleft < smallimagedata.pos.l;
|
667 |
-
}
|
668 |
-
|
669 |
-
function overright() {
|
670 |
-
|
671 |
-
return mousepos.x + (lensdata.w + 2* 1)/2 > smallimagedata.pos.r + bleft ;
|
672 |
-
}
|
673 |
-
|
674 |
-
function overtop() {
|
675 |
-
return mousepos.y - (lensdata.h + 2* 1)/2 - btop < smallimagedata.pos.t;
|
676 |
-
}
|
677 |
-
|
678 |
-
function overbottom() {
|
679 |
-
return mousepos.y + (lensdata.h + 2* 1)/2 > smallimagedata.pos.b + btop;
|
680 |
-
}
|
681 |
-
|
682 |
-
return this;
|
683 |
-
};
|
684 |
-
|
685 |
-
|
686 |
-
//mostra la lente al centro dell'immagine
|
687 |
-
Lens.prototype.center = function()
|
688 |
-
{
|
689 |
-
$('div.jqZoomPup',a).css('display','none');
|
690 |
-
document.getElementById("roll_on").innerHTML = "Roll on to zoom in";
|
691 |
-
var lensleft = (smallimagedata.w)/2 - (lensdata.w)/2 ;
|
692 |
-
var lenstop = (smallimagedata.h)/2 - (lensdata.h)/2;
|
693 |
-
this.node.style.left = lensleft + 'px';
|
694 |
-
this.node.style.top = lenstop + 'px';
|
695 |
-
$('div.jqZoomPup',a).css({top: lenstop,left: lensleft });
|
696 |
-
|
697 |
-
if(settings.zoomType == 'reverse')
|
698 |
-
{
|
699 |
-
/*if($.browser.safari){
|
700 |
-
alert('safari');
|
701 |
-
alert(2*bleft);
|
702 |
-
$('div.jqZoomPup img',a).css({'position': 'absolute','top': -( lenstop - btop +1) ,'left': -(lensleft - 2*bleft) });
|
703 |
-
}else
|
704 |
-
{*/
|
705 |
-
$('div.jqZoomPup img',a).css({'position': 'absolute','top': -(lenstop - btop + 1) ,'left': -( lensleft - bleft +1) });
|
706 |
-
//}
|
707 |
-
}
|
708 |
-
|
709 |
-
largeimage.setposition();
|
710 |
-
if($.browser.msie)
|
711 |
-
{
|
712 |
-
$('div.jqZoomPup',a).show();
|
713 |
-
document.getElementById("roll_on").innerHTML = "Roll off to zoom out";
|
714 |
-
}else
|
715 |
-
{
|
716 |
-
setTimeout(function(){$('div.jqZoomPup').fadeIn('fast');},10);
|
717 |
-
}
|
718 |
-
};
|
719 |
-
|
720 |
-
|
721 |
-
//ritorna l'offset
|
722 |
-
Lens.prototype.getoffset = function() {
|
723 |
-
var o = {};
|
724 |
-
o.left = parseInt(this.node.style.left) ;
|
725 |
-
o.top = parseInt(this.node.style.top) ;
|
726 |
-
return o;
|
727 |
-
};
|
728 |
-
|
729 |
-
//rimuove la lente
|
730 |
-
Lens.prototype.remove = function()
|
731 |
-
{
|
732 |
-
|
733 |
-
if(settings.zoomType == 'innerzoom')
|
734 |
-
{
|
735 |
-
$('div.jqZoomPup',a).fadeOut('fast',function(){/*$('div.jqZoomPup img').remove();*/$(this).remove();});
|
736 |
-
|
737 |
-
}else
|
738 |
-
{
|
739 |
-
//$('div.jqZoomPup img').remove();
|
740 |
-
$('div.jqZoomPup',a).remove();
|
741 |
-
document.getElementById("roll_on").innerHTML = "Roll on to zoom in";
|
742 |
-
}
|
743 |
-
};
|
744 |
-
|
745 |
-
Lens.prototype.findborder = function()
|
746 |
-
{
|
747 |
-
var bordertop = '';
|
748 |
-
bordertop = $('div.jqZoomPup').css('borderTop');
|
749 |
-
//alert(bordertop);
|
750 |
-
lensbtop = '';
|
751 |
-
var borderleft = '';
|
752 |
-
borderleft = $('div.jqZoomPup').css('borderLeft');
|
753 |
-
lensbleft = '';
|
754 |
-
if($.browser.msie)
|
755 |
-
{
|
756 |
-
var temp = bordertop.split(' ');
|
757 |
-
|
758 |
-
bordertop = temp[1];
|
759 |
-
var temp = borderleft.split(' ');
|
760 |
-
borderleft = temp[1];
|
761 |
-
}
|
762 |
-
|
763 |
-
if(bordertop)
|
764 |
-
{
|
765 |
-
for(i=0;i<3;i++)
|
766 |
-
{
|
767 |
-
var x = [];
|
768 |
-
x = bordertop.substr(i,1);
|
769 |
-
|
770 |
-
if(isNaN(x) == false)
|
771 |
-
{
|
772 |
-
lensbtop = lensbtop +''+ bordertop.substr(i,1);
|
773 |
-
}else
|
774 |
-
{
|
775 |
-
break;
|
776 |
-
}
|
777 |
-
}
|
778 |
-
}
|
779 |
-
|
780 |
-
if(borderleft)
|
781 |
-
{
|
782 |
-
for(i=0;i<3;i++)
|
783 |
-
{
|
784 |
-
if(!isNaN(borderleft.substr(i,1)))
|
785 |
-
{
|
786 |
-
lensbleft = lensbleft + borderleft.substr(i,1)
|
787 |
-
}else
|
788 |
-
{
|
789 |
-
break;
|
790 |
-
}
|
791 |
-
}
|
792 |
-
}
|
793 |
-
|
794 |
-
|
795 |
-
lensbtop = (lensbtop.length > 0) ? eval(lensbtop) : 0;
|
796 |
-
lensbleft = (lensbleft.length > 0) ? eval(lensbleft) : 0;
|
797 |
-
}
|
798 |
-
|
799 |
-
//LARGEIMAGE
|
800 |
-
function Largeimage( url )
|
801 |
-
{
|
802 |
-
this.url = url;
|
803 |
-
this.node = new Image();
|
804 |
-
|
805 |
-
/*if(settings.preloadImages)
|
806 |
-
{
|
807 |
-
preload.push(new Image());
|
808 |
-
preload.slice(-1).src = url ;
|
809 |
-
}*/
|
810 |
-
|
811 |
-
this.loadimage = function()
|
812 |
-
{
|
813 |
-
|
814 |
-
|
815 |
-
if(!this.node)
|
816 |
-
this.node = new Image();
|
817 |
-
|
818 |
-
this.node.style.position = 'absolute';
|
819 |
-
this.node.style.display = 'none';
|
820 |
-
this.node.style.left = '-5000px';
|
821 |
-
this.node.style.top = '10px';
|
822 |
-
loader = new Loader();
|
823 |
-
|
824 |
-
if(settings.showPreload && !preloadshow)
|
825 |
-
{
|
826 |
-
loader.show();
|
827 |
-
preloadshow = true;
|
828 |
-
}
|
829 |
-
|
830 |
-
document.body.appendChild( this.node );
|
831 |
-
this.node.src = this.url; // fires off async
|
832 |
-
}
|
833 |
-
|
834 |
-
this.node.onload = function()
|
835 |
-
{
|
836 |
-
this.style.display = 'block';
|
837 |
-
var w = Math.round($(this).width());
|
838 |
-
var h = Math.round($(this).height());
|
839 |
-
|
840 |
-
this.style.display = 'none';
|
841 |
-
|
842 |
-
//setting scale
|
843 |
-
scale.x = (w / smallimagedata.w);
|
844 |
-
scale.y = (h / smallimagedata.h);
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
if($('div.preload').length > 0)
|
851 |
-
{
|
852 |
-
$('div.preload').remove();
|
853 |
-
}
|
854 |
-
|
855 |
-
largeimageloaded = true;
|
856 |
-
|
857 |
-
if(settings.zoomType != 'innerzoom' && running){
|
858 |
-
stage = new Stage();
|
859 |
-
stage.activate();
|
860 |
-
}
|
861 |
-
|
862 |
-
if(running)
|
863 |
-
{
|
864 |
-
//alert('in');
|
865 |
-
lens = new Lens();
|
866 |
|
867 |
-
lens.activate() ;
|
868 |
|
869 |
-
|
870 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
871 |
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
}
|
876 |
-
}
|
877 |
-
return this;
|
878 |
-
}
|
879 |
|
|
|
880 |
|
881 |
-
|
882 |
-
|
883 |
-
this.node.style.left = Math.ceil( - scale.x * parseInt(lens.getoffset().left) + bleft) + 'px';
|
884 |
-
this.node.style.top = Math.ceil( - scale.y * parseInt(lens.getoffset().top) +btop) + 'px';
|
885 |
-
};
|
886 |
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
|
894 |
|
895 |
-
|
896 |
-
|
897 |
-
|
|
|
898 |
|
|
|
|
|
|
|
|
|
|
|
|
|
899 |
|
900 |
-
$('div.jqZoomPup img',a).css({'position': 'absolute','top': this.node.style.top,'left': this.node.style.left });
|
901 |
-
};
|
902 |
|
|
|
|
|
|
|
903 |
|
904 |
-
//STAGE
|
905 |
-
function Stage()
|
906 |
-
{
|
907 |
|
908 |
-
|
909 |
-
|
910 |
-
//creating element and class
|
911 |
-
this.node = document.createElement("div");
|
912 |
-
$(this.node).addClass('jqZoomWindow');
|
913 |
|
914 |
-
$( this.node )
|
915 |
-
.css({
|
916 |
-
position: 'absolute',
|
917 |
-
width: Math.round(settings.zoomWidth) + 'px',
|
918 |
-
height: Math.round(settings.zoomHeight) + 'px',
|
919 |
-
display: 'none',
|
920 |
-
zIndex: 10000,
|
921 |
-
overflow: 'hidden'
|
922 |
-
});
|
923 |
|
924 |
-
|
925 |
-
|
926 |
-
{
|
927 |
-
case "right":
|
928 |
|
929 |
-
|
930 |
-
|
931 |
-
|
|
|
|
|
932 |
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
|
|
|
|
|
|
|
|
|
|
937 |
|
938 |
-
|
939 |
-
|
|
|
940 |
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
|
950 |
-
|
951 |
-
|
952 |
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
|
|
|
|
|
|
|
|
|
957 |
|
958 |
-
|
959 |
-
|
960 |
-
? smallimagedata.pos.l + settings.xOffset
|
961 |
-
: smallimagedata.pos.l;
|
962 |
|
963 |
-
|
964 |
-
|
|
|
965 |
|
966 |
|
967 |
-
|
968 |
-
|
969 |
-
|
|
|
970 |
|
|
|
|
|
971 |
|
972 |
-
leftwindow = smallimagedata.pos.l + settings.xOffset + settings.zoomWidth;
|
973 |
-
leftpos = (leftwindow < screen.width && leftwindow > 0)
|
974 |
-
? smallimagedata.pos.l + settings.xOffset
|
975 |
-
: smallimagedata.pos.l;
|
976 |
-
|
977 |
-
break;
|
978 |
-
default:
|
979 |
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
|
984 |
-
toppos = (smallimagedata.pos.b + Math.abs(settings.yOffset) + settings.zoomHeight < screen.height)
|
985 |
-
? (smallimagedata.pos.b + Math.abs(settings.yOffset))
|
986 |
-
: (smallimagedata.pos.t - settings.zoomHeight - Math.abs(settings.yOffset));
|
987 |
|
988 |
-
|
989 |
-
|
|
|
|
|
990 |
|
991 |
-
|
992 |
-
|
993 |
-
return this;
|
994 |
-
}
|
995 |
|
|
|
|
|
|
|
996 |
|
997 |
-
|
998 |
-
|
|
|
999 |
|
1000 |
-
|
1001 |
-
|
|
|
|
|
|
|
|
|
|
|
1002 |
|
1003 |
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
return o;
|
1128 |
-
}
|
1129 |
-
|
1130 |
-
});
|
1131 |
-
}
|
1132 |
-
})(jQuery);
|
1133 |
-
|
1134 |
-
function trim(stringa)
|
1135 |
-
{
|
1136 |
-
while (stringa.substring(0,1) == ' '){
|
1137 |
-
stringa = stringa.substring(1, stringa.length);
|
1138 |
-
}
|
1139 |
-
while (stringa.substring(stringa.length-1, stringa.length) == ' '){
|
1140 |
-
stringa = stringa.substring(0,stringa.length-1);
|
1141 |
-
}
|
1142 |
-
return stringa;
|
1143 |
-
}
|
9 |
*
|
10 |
* $License : GPL,so any change to the code you should copy and paste this section,and would be nice to report this to me(renzi.mrc@gmail.com).
|
11 |
*/
|
12 |
+
(function ($) {
|
13 |
+
$.fn.jqzoom = function (options) {
|
14 |
+
|
15 |
+
|
|
|
|
|
16 |
var settings = {
|
17 |
zoomType: 'standard', //standard/reverse/innerzoom
|
18 |
zoomWidth: 200, //zoomed width default width
|
19 |
zoomHeight: 200, //zoomed div default width
|
20 |
xOffset: 10, //zoomed div default offset
|
21 |
yOffset: 0,
|
22 |
+
position: "right",//zoomed div default position,offset position is to the right of the image
|
23 |
+
lens: true, //zooming lens over the image,by default is 1;
|
24 |
+
lensReset: false,
|
25 |
+
imageOpacity: 0.2,
|
26 |
+
title: true,
|
27 |
+
alwaysOn: false,
|
28 |
+
showEffect: 'show',
|
29 |
+
hideEffect: 'hide',
|
30 |
+
fadeinSpeed: 'fast',
|
31 |
+
fadeoutSpeed: 'slow',
|
32 |
+
preloadImages: true,
|
33 |
+
showPreload: true,
|
34 |
+
preloadText: 'Loading zoom',
|
35 |
+
preloadPosition: 'center' //bycss
|
36 |
};
|
37 |
|
38 |
+
//extending options
|
39 |
+
options = options || {};
|
40 |
+
$.extend(settings, options);
|
41 |
|
42 |
|
43 |
+
return this.each(function () {
|
44 |
+
var a = $(this);
|
45 |
+
var aTitle = a.attr('title'); //variabile per memorizzare il titolo href
|
46 |
+
$(a).removeAttr('title');
|
47 |
+
$(a).css('outline-style', 'none');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
|
|
49 |
|
50 |
+
var img = $("img", this);
|
51 |
+
var imageTitle = img.attr('title');
|
52 |
+
img.removeAttr('title'); //variabile per memorizzare il titolo immagine
|
53 |
+
|
54 |
+
var smallimage = new Smallimage(img);
|
55 |
+
var smallimagedata = {};
|
56 |
+
//imageborder
|
57 |
+
var btop = 0;
|
58 |
+
var bleft = 0;
|
59 |
+
|
60 |
+
var loader = null; //variabile per memorizzare oggetto loader
|
61 |
+
loader = new Loader();
|
62 |
+
|
63 |
+
// trim white space
|
64 |
+
imageTitle = imageTitle.replace(/\s+/g, ' ');
|
65 |
+
aTitle = aTitle.replace(/\s+/g, ' ');
|
66 |
+
|
67 |
+
|
68 |
+
var ZoomTitle = (aTitle.length > 0) ? aTitle :
|
69 |
+
(imageTitle.length > 0) ? imageTitle : null; //setting zoomtitle
|
70 |
+
var ZoomTitleObj = new zoomTitle();
|
71 |
+
|
72 |
+
var largeimage = new Largeimage(a[0].href);
|
73 |
+
|
74 |
+
var lens = new Lens();
|
75 |
+
var lensdata = {};
|
76 |
+
//lensborder
|
77 |
+
|
78 |
+
|
79 |
+
var largeimageloaded = false;
|
80 |
+
var scale = {}; //rapporto tra immagine grande e piccola scale.x/scale.y
|
81 |
+
var stage = null; // quadrato che mostra l'immagine ingrandita
|
82 |
+
var running = false; // running = true quando si verifica l'evento che mostra lo zoom(adesso mouseover).
|
83 |
+
var mousepos = {};
|
84 |
+
var firstime = 0;
|
85 |
+
var preloadshow = false;
|
86 |
+
var isMouseDown = false;
|
87 |
+
var dragstatus = false
|
88 |
+
//loading smallimagedata
|
89 |
+
smallimage.loadimage();
|
90 |
+
|
91 |
+
//ritorna false al click dell href
|
92 |
+
$(this).click(function () {
|
93 |
+
return false;
|
94 |
+
});
|
95 |
+
|
96 |
+
//se settato alwaysOn attivo lo Zoom e lo mostro.
|
97 |
+
|
98 |
+
//attivo al mouseover
|
99 |
+
$(this).hover(function (e) {
|
100 |
+
mousepos.x = e.pageX;
|
101 |
+
mousepos.y = e.pageY;
|
102 |
+
activate();
|
103 |
+
}, function () {
|
104 |
+
deactivate();
|
105 |
+
});
|
106 |
+
|
107 |
+
|
108 |
+
//ALWAYS ON
|
109 |
+
if (settings.alwaysOn) {
|
110 |
+
setTimeout(function () {
|
111 |
+
activate();
|
112 |
+
}, 150);
|
113 |
+
}
|
114 |
+
|
115 |
+
|
116 |
+
function activate() {
|
117 |
+
|
118 |
+
if (!running) {
|
119 |
+
|
120 |
+
//finding border
|
121 |
+
smallimage.findborder();
|
122 |
+
|
123 |
+
running = true;
|
124 |
+
|
125 |
+
//rimuovo il titolo al mouseover
|
126 |
+
imageTitle = img.attr('title');
|
127 |
+
img.removeAttr('title');
|
128 |
+
aTitle = a.attr('title');
|
129 |
+
$(a).removeAttr('title');
|
130 |
+
|
131 |
+
//se non c� creo l'oggetto largeimage
|
132 |
+
if (!largeimage || $.browser.safari) {
|
133 |
+
largeimage = new Largeimage(a[0].href);
|
134 |
+
}
|
135 |
+
|
136 |
+
//se l'immagine grande non � stata caricata la carico
|
137 |
+
if (!largeimageloaded || $.browser.safari) {
|
138 |
+
largeimage.loadimage();
|
139 |
+
} else {
|
140 |
+
//after preload
|
141 |
+
if (settings.zoomType != 'innerzoom') {
|
142 |
+
stage = new Stage();
|
143 |
+
stage.activate();
|
144 |
+
}
|
145 |
+
lens = new Lens;
|
146 |
+
lens.activate();
|
147 |
+
}
|
148 |
+
|
149 |
+
//hack per MAC
|
150 |
+
/* if($.browser.safari)
|
151 |
+
{
|
152 |
+
if(settings.zoomType != 'innerzoom') //se innerzoom non mostro la finestra dello zoom
|
153 |
+
{
|
154 |
+
stage = new Stage();
|
155 |
+
stage.activate();
|
156 |
+
}
|
157 |
+
if($('div.jqZoomPup').length <= 0)
|
158 |
+
{
|
159 |
+
lens = new Lens();
|
160 |
+
}
|
161 |
+
//if(settings.zoomType == 'innerzoom'){lens = new Lens()};
|
162 |
+
lens.activate();
|
163 |
+
(settings.alwaysOn) ? lens.center() : lens.setposition(null);
|
164 |
+
}
|
165 |
+
*/
|
166 |
+
a[0].blur();
|
167 |
+
//alert($('div.jqZoomPup').length);
|
168 |
+
return false;
|
169 |
+
}
|
170 |
+
|
171 |
+
|
172 |
+
}
|
173 |
+
|
174 |
+
function deactivate() {
|
175 |
+
if (settings.zoomType == 'reverse' && !settings.alwaysOn) {
|
176 |
+
img.css({'opacity': 1});
|
177 |
+
}
|
178 |
+
|
179 |
+
if (!settings.alwaysOn) {
|
180 |
+
//resetting parameters
|
181 |
+
running = false;
|
182 |
+
largeimageloaded = false;
|
183 |
+
$(lens.node).unbind('mousemove');
|
184 |
+
lens.remove();
|
185 |
+
if ($('div.jqZoomWindow').length > 0) {
|
186 |
+
stage.remove();
|
187 |
+
}
|
188 |
+
if ($('div.jqZoomTitle').length > 0) {
|
189 |
+
ZoomTitleObj.remove();
|
190 |
+
}
|
191 |
+
//resetting title
|
192 |
+
img.attr('title', imageTitle);
|
193 |
+
a.attr('title', aTitle);
|
194 |
+
$().unbind();
|
195 |
+
|
196 |
+
a.unbind('mousemove');
|
197 |
+
//resetto il parametro che mi dice che � la prima volta che mostor lo zoom
|
198 |
+
firstime = 0;
|
199 |
+
//remove ieiframe
|
200 |
+
if (jQuery('.zoom_ieframe').length > 0) {
|
201 |
+
jQuery('.zoom_ieframe').remove();
|
202 |
+
}
|
203 |
+
} else {
|
204 |
+
if (settings.lensReset) {
|
205 |
+
switch (settings.zoomType) {
|
206 |
+
case 'innerzoom':
|
207 |
+
largeimage.setcenter();
|
208 |
+
break;
|
209 |
+
default:
|
210 |
+
lens.center();
|
211 |
+
break;
|
212 |
+
}
|
213 |
+
}
|
214 |
+
}
|
215 |
+
|
216 |
+
//non so se serve da provare
|
217 |
+
if (settings.alwaysOn) {
|
218 |
+
activate();
|
219 |
+
}
|
220 |
+
};
|
221 |
+
|
222 |
+
|
223 |
+
//smallimage
|
224 |
+
function Smallimage(image) {
|
225 |
+
this.node = image[0];
|
226 |
+
|
227 |
+
this.loadimage = function () {
|
228 |
+
this.node.src = image[0].src;
|
229 |
+
if (typeof smallimagedata.top === "undefined") {
|
230 |
+
this.node.onload();
|
231 |
+
}
|
232 |
+
|
233 |
+
};
|
234 |
+
|
235 |
+
this.findborder = function () {
|
236 |
+
var bordertop = '';
|
237 |
+
bordertop = $(img).css('border-top-width');
|
238 |
+
btop = '';
|
239 |
+
var borderleft = '';
|
240 |
+
borderleft = $(img).css('border-left-width');
|
241 |
+
bleft = '';
|
242 |
+
/*if($.browser.msie)
|
243 |
+
{
|
244 |
+
var temp = bordertop.split(' ');
|
245 |
+
|
246 |
+
bordertop = temp[1];
|
247 |
+
var temp = borderleft.split(' ');
|
248 |
+
borderleft = temp[1];
|
249 |
+
}*/
|
250 |
+
|
251 |
+
if (bordertop) {
|
252 |
+
for (i = 0; i < 3; i++) {
|
253 |
+
var x = [];
|
254 |
+
x = bordertop.substr(i, 1);
|
255 |
+
|
256 |
+
if (isNaN(x) == false) {
|
257 |
+
btop = btop + '' + bordertop.substr(i, 1);
|
258 |
+
} else {
|
259 |
+
break;
|
260 |
+
}
|
261 |
+
}
|
262 |
+
}
|
263 |
+
|
264 |
+
if (borderleft) {
|
265 |
+
for (i = 0; i < 3; i++) {
|
266 |
+
if (!isNaN(borderleft.substr(i, 1))) {
|
267 |
+
bleft = bleft + borderleft.substr(i, 1)
|
268 |
+
} else {
|
269 |
+
break;
|
270 |
+
}
|
271 |
+
}
|
272 |
+
}
|
273 |
+
btop = (btop.length > 0) ? eval(btop) : 0;
|
274 |
+
bleft = (bleft.length > 0) ? eval(bleft) : 0;
|
275 |
+
|
276 |
+
|
277 |
+
}
|
278 |
+
|
279 |
+
|
280 |
+
this.node.onload = function () {
|
281 |
+
//setto il cursor e la posizione dell'href
|
282 |
+
|
283 |
+
|
284 |
+
a.css({'cursor': 'crosshair', 'display': 'block'});
|
285 |
+
|
286 |
+
if (a.css('position') != 'absolute' && a.parent().css('position')) {
|
287 |
+
a.css({'cursor': 'crosshair', 'position': 'relative', 'display': 'block'});
|
288 |
+
}
|
289 |
+
if (a.parent().css('position') != 'absolute') {
|
290 |
+
a.parent().css('position', 'relative');
|
291 |
+
//a.css('position','relative');
|
292 |
+
}
|
293 |
+
else {
|
294 |
+
//a.css('position','relative');
|
295 |
+
}
|
296 |
+
if ($.browser.safari || $.browser.opera) {
|
297 |
+
$(img).css({position: 'absolute', top: '0px', left: '0px'});
|
298 |
+
}
|
299 |
+
/*if(a.css('position')!= 'absolute' && a.parent().css('position'))
|
300 |
+
{
|
301 |
+
a.css({'cursor':'crosshair','position':'relative','display':'block'});
|
302 |
+
}
|
303 |
+
if(a.parent().css('position') != 'absolute')
|
304 |
+
{
|
305 |
+
alert('in');
|
306 |
+
a.parent().css('position','relative');
|
307 |
+
//a.css('position','relative');
|
308 |
+
}
|
309 |
+
else{
|
310 |
+
//a.css('position','relative');
|
311 |
+
}*/
|
312 |
+
|
313 |
+
|
314 |
+
/*
|
315 |
+
if(a.parent().css('position') != 'relative' && a.css('position') != 'absolute')
|
316 |
+
{
|
317 |
+
a.css({'cursor':'crosshair','position':'relative','display':'block'});
|
318 |
+
}*/
|
319 |
+
|
320 |
+
//al docuemnt ready viene caricato l'src quindi viene azionato l'onload e carico tutti i dati
|
321 |
+
smallimagedata.w = $(this).width();
|
322 |
+
smallimagedata.h = $(this).height();
|
323 |
+
|
324 |
+
|
325 |
+
//non viene fatta assegnazione alla variabile globale
|
326 |
+
smallimagedata.h = $(this).height();
|
327 |
+
smallimagedata.pos = $(this).offset();
|
328 |
+
smallimagedata.pos.l = $(this).offset().left;
|
329 |
+
smallimagedata.pos.t = $(this).offset().top;
|
330 |
+
smallimagedata.pos.r = smallimagedata.w + smallimagedata.pos.l;
|
331 |
+
smallimagedata.pos.b = smallimagedata.h + smallimagedata.pos.t;
|
332 |
+
|
333 |
+
//per sicurezza setto l'altezza e la width dell'href
|
334 |
+
a.height(smallimagedata.h);
|
335 |
+
a.width(smallimagedata.w);
|
336 |
+
|
337 |
+
|
338 |
+
//PRELOAD IMAGES
|
339 |
+
if (settings.preloadImages) {
|
340 |
+
largeimage.loadimage();
|
341 |
+
}
|
342 |
+
|
343 |
+
|
344 |
+
};
|
345 |
+
|
346 |
+
|
347 |
+
return this;
|
348 |
+
};
|
349 |
+
|
350 |
+
|
351 |
+
//Lens
|
352 |
+
function Lens() {
|
353 |
+
|
354 |
+
|
355 |
+
//creating element and adding class
|
356 |
+
this.node = document.createElement("div");
|
357 |
+
$(this.node).addClass('jqZoomPup');
|
358 |
+
|
359 |
+
this.node.onerror = function () {
|
360 |
+
$(lens.node).remove();
|
361 |
+
lens = new Lens();
|
362 |
+
lens.activate();
|
363 |
+
};
|
364 |
+
|
365 |
+
|
366 |
+
//funzione privata per il caricamento dello zoom
|
367 |
+
this.loadlens = function () {
|
368 |
+
|
369 |
+
|
370 |
+
switch (settings.zoomType) {
|
371 |
+
case 'reverse':
|
372 |
+
this.image = new Image();
|
373 |
+
this.image.src = smallimage.node.src; // fires off async
|
374 |
+
this.node.appendChild(this.image);
|
375 |
+
$(this.node).css({'opacity': 1});
|
376 |
+
break;
|
377 |
+
case 'innerzoom':
|
378 |
+
|
379 |
+
this.image = new Image();
|
380 |
+
this.image.src = largeimage.node.src; // fires off async
|
381 |
+
this.node.appendChild(this.image);
|
382 |
+
$(this.node).css({'opacity': 1});
|
383 |
+
break
|
384 |
+
default:
|
385 |
+
break;
|
386 |
+
}
|
387 |
+
|
388 |
+
|
389 |
+
switch (settings.zoomType) {
|
390 |
+
case 'innerzoom':
|
391 |
+
lensdata.w = smallimagedata.w;
|
392 |
+
lensdata.h = smallimagedata.h;
|
393 |
+
break;
|
394 |
+
default:
|
395 |
+
lensdata.w = (settings.zoomWidth) / scale.x;
|
396 |
+
lensdata.h = (settings.zoomHeight) / scale.y;
|
397 |
+
break;
|
398 |
+
}
|
399 |
+
|
400 |
+
$(this.node).css({
|
401 |
+
width: lensdata.w + 'px',
|
402 |
+
height: lensdata.h + 'px',
|
403 |
+
position: 'absolute',
|
404 |
+
/*cursor: 'crosshair',*/
|
405 |
+
display: 'none',
|
406 |
+
//border: '1px solid blue'
|
407 |
+
borderWidth: 1 + 'px'
|
408 |
+
});
|
409 |
+
a.append(this.node);
|
410 |
+
}
|
411 |
+
return this;
|
412 |
+
};
|
413 |
+
|
414 |
+
Lens.prototype.activate = function () {
|
415 |
+
//carico la lente
|
416 |
+
this.loadlens();
|
417 |
+
|
418 |
+
switch (settings.zoomType) {
|
419 |
+
case 'reverse':
|
420 |
+
img.css({'opacity': settings.imageOpacity});
|
421 |
+
|
422 |
+
(settings.alwaysOn) ? lens.center() : lens.setposition(null);
|
423 |
+
//lens.center();
|
424 |
+
//bindo ad a il mousemove della lente
|
425 |
+
a.bind('mousemove', function (e) {
|
426 |
+
mousepos.x = e.pageX;
|
427 |
+
mousepos.y = e.pageY;
|
428 |
+
lens.setposition(e);
|
429 |
+
});
|
430 |
+
break;
|
431 |
+
case 'innerzoom':
|
432 |
+
|
433 |
+
// lens = new Lens();
|
434 |
+
// lens.activate();
|
435 |
+
|
436 |
+
$(this.node).css({top: 0, left: 0});
|
437 |
+
if (settings.title) {
|
438 |
+
ZoomTitleObj.loadtitle();
|
439 |
+
}
|
440 |
+
|
441 |
+
largeimage.setcenter();
|
442 |
+
|
443 |
+
a.bind('mousemove', function (e) {
|
444 |
+
mousepos.x = e.pageX;
|
445 |
+
mousepos.y = e.pageY;
|
446 |
+
largeimage.setinner(e);
|
447 |
+
|
448 |
+
/*if(settings.zoomType == 'innerzoom' && running)
|
449 |
+
{
|
450 |
+
$(a).mousemove(function(){
|
451 |
+
if($('div.jqZoomPup').length <= 0)
|
452 |
+
{
|
453 |
+
lens = new Lens();
|
454 |
+
lens.activate();
|
455 |
+
}
|
456 |
+
});
|
457 |
+
}*/
|
458 |
+
|
459 |
+
/*if($('div.jqZoomPup').length <= 0)
|
460 |
+
{
|
461 |
+
lens = new Lens();
|
462 |
+
lens.activate();
|
463 |
+
}*/
|
464 |
+
|
465 |
+
});
|
466 |
+
break;
|
467 |
+
default:
|
468 |
+
/*$(document).mousemove(function(e){
|
469 |
+
if(isMouseDown && dragstatus != false){
|
470 |
+
lens.setposition( e );
|
471 |
+
}
|
472 |
+
});
|
473 |
+
lens.center()
|
474 |
+
|
475 |
+
|
476 |
+
dragstatus = 'on'
|
477 |
+
$(document).mouseup(function(e){
|
478 |
+
if(isMouseDown && dragstatus != false){
|
479 |
+
isMouseDown = false;
|
480 |
+
dragstatus = false;
|
481 |
+
|
482 |
+
}
|
483 |
+
});
|
484 |
+
|
485 |
+
$(this.node).mousedown(function(e){
|
486 |
+
$('div.jqZoomPup').css("cursor", "move");
|
487 |
+
$(this.node).css("position", "absolute");
|
488 |
+
|
489 |
+
// set z-index
|
490 |
+
$(this.node).css("z-index", parseInt( new Date().getTime()/1000 ));
|
491 |
+
if($.browser.safari)
|
492 |
+
{
|
493 |
+
$(a).css("cursor", "move");
|
494 |
+
}
|
495 |
+
isMouseDown = true;
|
496 |
+
dragstatus = 'on';
|
497 |
+
lens.setposition( e );
|
498 |
+
});
|
499 |
+
*/
|
500 |
+
|
501 |
+
|
502 |
+
(settings.alwaysOn) ? lens.center() : lens.setposition(null);
|
503 |
+
|
504 |
+
//bindo ad a il mousemove della lente
|
505 |
+
$(a).bind('mousemove', function (e) {
|
506 |
+
|
507 |
+
mousepos.x = e.pageX;
|
508 |
+
mousepos.y = e.pageY;
|
509 |
+
lens.setposition(e);
|
510 |
+
});
|
511 |
+
|
512 |
+
break;
|
513 |
+
}
|
514 |
+
|
515 |
+
|
516 |
+
return this;
|
517 |
+
};
|
518 |
+
|
519 |
+
Lens.prototype.setposition = function (e) {
|
520 |
+
|
521 |
+
|
522 |
+
if (e) {
|
523 |
+
mousepos.x = e.pageX;
|
524 |
+
mousepos.y = e.pageY;
|
525 |
+
}
|
526 |
+
|
527 |
+
if (firstime == 0) {
|
528 |
+
var lensleft = (smallimagedata.w) / 2 - (lensdata.w) / 2;
|
529 |
+
var lenstop = (smallimagedata.h) / 2 - (lensdata.h) / 2;
|
530 |
+
//ADDED
|
531 |
+
|
532 |
+
|
533 |
+
$('div.jqZoomPup').show()
|
534 |
+
if (settings.lens) {
|
535 |
+
this.node.style.visibility = 'visible';
|
536 |
+
document.getElementById("roll_on").innerHTML = "Roll off to zoom out";
|
537 |
+
}
|
538 |
+
else {
|
539 |
+
this.node.style.visibility = 'hidden';
|
540 |
+
document.getElementById("roll_on").innerHTML = "Roll on to zoom in";
|
541 |
+
$('div.jqZoomPup').hide();
|
542 |
+
|
543 |
+
}
|
544 |
+
//ADDED
|
545 |
+
firstime = 1;
|
546 |
+
|
547 |
+
} else {
|
548 |
+
var lensleft = mousepos.x - smallimagedata.pos.l - (lensdata.w) / 2;
|
549 |
+
var lenstop = mousepos.y - smallimagedata.pos.t - (lensdata.h) / 2;
|
550 |
+
}
|
551 |
+
|
552 |
+
|
553 |
+
//a sinistra
|
554 |
+
if (overleft()) {
|
555 |
+
lensleft = 0 + bleft;
|
556 |
+
} else
|
557 |
+
//a destra
|
558 |
+
if (overright()) {
|
559 |
+
if ($.browser.msie) {
|
560 |
+
lensleft = smallimagedata.w - lensdata.w + bleft + 1;
|
561 |
+
} else {
|
562 |
+
lensleft = smallimagedata.w - lensdata.w + bleft - 1;
|
563 |
+
}
|
564 |
+
|
565 |
+
|
566 |
+
}
|
567 |
+
|
568 |
+
//in alto
|
569 |
+
if (overtop()) {
|
570 |
+
lenstop = 0 + btop;
|
571 |
+
} else
|
572 |
+
//sotto
|
573 |
+
if (overbottom()) {
|
574 |
+
|
575 |
+
if ($.browser.msie) {
|
576 |
+
lenstop = smallimagedata.h - lensdata.h + btop + 1;
|
577 |
+
} else {
|
578 |
+
lenstop = smallimagedata.h - lensdata.h - 1 + btop;
|
579 |
+
}
|
580 |
+
|
581 |
+
}
|
582 |
+
lensleft = parseInt(lensleft);
|
583 |
+
lenstop = parseInt(lenstop);
|
584 |
+
|
585 |
+
//setto lo zoom ed un eventuale immagine al centro
|
586 |
+
$('div.jqZoomPup', a).css({top: lenstop, left: lensleft });
|
587 |
+
|
588 |
+
if (settings.zoomType == 'reverse') {
|
589 |
+
$('div.jqZoomPup img', a).css({'position': 'absolute', 'top': -( lenstop - btop + 1), 'left': -(lensleft - bleft + 1) });
|
590 |
+
}
|
591 |
+
|
592 |
+
this.node.style.left = lensleft + 'px';
|
593 |
+
this.node.style.top = lenstop + 'px';
|
594 |
+
|
595 |
+
//setto l'immagine grande
|
596 |
+
largeimage.setposition();
|
597 |
+
|
598 |
+
function overleft() {
|
599 |
+
return mousepos.x - (lensdata.w + 2 * 1) / 2 - bleft < smallimagedata.pos.l;
|
600 |
+
}
|
601 |
+
|
602 |
+
function overright() {
|
603 |
+
|
604 |
+
return mousepos.x + (lensdata.w + 2 * 1) / 2 > smallimagedata.pos.r + bleft;
|
605 |
+
}
|
606 |
+
|
607 |
+
function overtop() {
|
608 |
+
return mousepos.y - (lensdata.h + 2 * 1) / 2 - btop < smallimagedata.pos.t;
|
609 |
+
}
|
610 |
+
|
611 |
+
function overbottom() {
|
612 |
+
return mousepos.y + (lensdata.h + 2 * 1) / 2 > smallimagedata.pos.b + btop;
|
613 |
+
}
|
614 |
+
|
615 |
+
return this;
|
616 |
+
};
|
617 |
+
|
618 |
+
|
619 |
+
//mostra la lente al centro dell'immagine
|
620 |
+
Lens.prototype.center = function () {
|
621 |
+
$('div.jqZoomPup', a).css('display', 'none');
|
622 |
+
document.getElementById("roll_on").innerHTML = "Roll on to zoom in";
|
623 |
+
var lensleft = (smallimagedata.w) / 2 - (lensdata.w) / 2;
|
624 |
+
var lenstop = (smallimagedata.h) / 2 - (lensdata.h) / 2;
|
625 |
+
this.node.style.left = lensleft + 'px';
|
626 |
+
this.node.style.top = lenstop + 'px';
|
627 |
+
$('div.jqZoomPup', a).css({top: lenstop, left: lensleft });
|
628 |
+
|
629 |
+
if (settings.zoomType == 'reverse') {
|
630 |
+
/*if($.browser.safari){
|
631 |
+
alert('safari');
|
632 |
+
alert(2*bleft);
|
633 |
+
$('div.jqZoomPup img',a).css({'position': 'absolute','top': -( lenstop - btop +1) ,'left': -(lensleft - 2*bleft) });
|
634 |
+
}else
|
635 |
+
{*/
|
636 |
+
$('div.jqZoomPup img', a).css({'position': 'absolute', 'top': -(lenstop - btop + 1), 'left': -( lensleft - bleft + 1) });
|
637 |
+
//}
|
638 |
+
}
|
639 |
+
|
640 |
+
largeimage.setposition();
|
641 |
+
if ($.browser.msie) {
|
642 |
+
$('div.jqZoomPup', a).show();
|
643 |
+
document.getElementById("roll_on").innerHTML = "Roll off to zoom out";
|
644 |
+
} else {
|
645 |
+
setTimeout(function () {
|
646 |
+
$('div.jqZoomPup').fadeIn('fast');
|
647 |
+
}, 10);
|
648 |
+
}
|
649 |
+
};
|
650 |
+
|
651 |
+
|
652 |
+
//ritorna l'offset
|
653 |
+
Lens.prototype.getoffset = function () {
|
654 |
+
var o = {};
|
655 |
+
o.left = parseInt(this.node.style.left);
|
656 |
+
o.top = parseInt(this.node.style.top);
|
657 |
+
return o;
|
658 |
+
};
|
659 |
+
|
660 |
+
//rimuove la lente
|
661 |
+
Lens.prototype.remove = function () {
|
662 |
+
|
663 |
+
if (settings.zoomType == 'innerzoom') {
|
664 |
+
$('div.jqZoomPup', a).fadeOut('fast', function () {/*$('div.jqZoomPup img').remove();*/
|
665 |
+
$(this).remove();
|
666 |
+
});
|
667 |
+
|
668 |
+
} else {
|
669 |
+
//$('div.jqZoomPup img').remove();
|
670 |
+
$('div.jqZoomPup', a).remove();
|
671 |
+
document.getElementById("roll_on").innerHTML = "Roll on to zoom in";
|
672 |
+
}
|
673 |
+
};
|
674 |
+
|
675 |
+
Lens.prototype.findborder = function () {
|
676 |
+
var bordertop = '';
|
677 |
+
bordertop = $('div.jqZoomPup').css('borderTop');
|
678 |
+
//alert(bordertop);
|
679 |
+
lensbtop = '';
|
680 |
+
var borderleft = '';
|
681 |
+
borderleft = $('div.jqZoomPup').css('borderLeft');
|
682 |
+
lensbleft = '';
|
683 |
+
if ($.browser.msie) {
|
684 |
+
var temp = bordertop.split(' ');
|
685 |
+
|
686 |
+
bordertop = temp[1];
|
687 |
+
var temp = borderleft.split(' ');
|
688 |
+
borderleft = temp[1];
|
689 |
+
}
|
690 |
+
|
691 |
+
if (bordertop) {
|
692 |
+
for (i = 0; i < 3; i++) {
|
693 |
+
var x = [];
|
694 |
+
x = bordertop.substr(i, 1);
|
695 |
+
|
696 |
+
if (isNaN(x) == false) {
|
697 |
+
lensbtop = lensbtop + '' + bordertop.substr(i, 1);
|
698 |
+
} else {
|
699 |
+
break;
|
700 |
+
}
|
701 |
+
}
|
702 |
+
}
|
703 |
+
|
704 |
+
if (borderleft) {
|
705 |
+
for (i = 0; i < 3; i++) {
|
706 |
+
if (!isNaN(borderleft.substr(i, 1))) {
|
707 |
+
lensbleft = lensbleft + borderleft.substr(i, 1)
|
708 |
+
} else {
|
709 |
+
break;
|
710 |
+
}
|
711 |
+
}
|
712 |
+
}
|
713 |
+
|
714 |
+
|
715 |
+
lensbtop = (lensbtop.length > 0) ? eval(lensbtop) : 0;
|
716 |
+
lensbleft = (lensbleft.length > 0) ? eval(lensbleft) : 0;
|
717 |
+
}
|
718 |
+
|
719 |
+
//LARGEIMAGE
|
720 |
+
function Largeimage(url) {
|
721 |
+
this.url = url;
|
722 |
+
this.node = new Image();
|
723 |
+
|
724 |
+
/*if(settings.preloadImages)
|
725 |
+
{
|
726 |
+
preload.push(new Image());
|
727 |
+
preload.slice(-1).src = url ;
|
728 |
+
}*/
|
729 |
+
|
730 |
+
this.loadimage = function () {
|
731 |
+
|
732 |
+
|
733 |
+
if (!this.node)
|
734 |
+
this.node = new Image();
|
735 |
+
|
736 |
+
this.node.style.position = 'absolute';
|
737 |
+
this.node.style.display = 'none';
|
738 |
+
this.node.style.left = '-5000px';
|
739 |
+
this.node.style.top = '10px';
|
740 |
+
loader = new Loader();
|
741 |
+
|
742 |
+
if (settings.showPreload && !preloadshow) {
|
743 |
+
loader.show();
|
744 |
+
preloadshow = true;
|
745 |
+
}
|
746 |
+
|
747 |
+
document.body.appendChild(this.node);
|
748 |
+
this.node.src = this.url; // fires off async
|
749 |
+
}
|
750 |
+
|
751 |
+
this.node.onload = function () {
|
752 |
+
this.style.display = 'block';
|
753 |
+
var w = Math.round($(this).width());
|
754 |
+
var h = Math.round($(this).height());
|
755 |
+
|
756 |
+
this.style.display = 'none';
|
757 |
+
|
758 |
+
//setting scale
|
759 |
+
scale.x = (w / smallimagedata.w);
|
760 |
+
scale.y = (h / smallimagedata.h);
|
761 |
+
|
762 |
+
|
763 |
+
if ($('div.preload').length > 0) {
|
764 |
+
$('div.preload').remove();
|
765 |
+
}
|
766 |
+
|
767 |
+
largeimageloaded = true;
|
768 |
+
|
769 |
+
if (settings.zoomType != 'innerzoom' && running) {
|
770 |
+
stage = new Stage();
|
771 |
+
stage.activate();
|
772 |
+
}
|
773 |
|
774 |
+
if (running) {
|
775 |
+
//alert('in');
|
776 |
+
lens = new Lens();
|
|
|
|
|
|
|
|
|
777 |
|
778 |
+
lens.activate();
|
779 |
|
780 |
+
}
|
781 |
+
//la attivo
|
|
|
|
|
|
|
782 |
|
783 |
+
if ($('div.preload').length > 0) {
|
784 |
+
$('div.preload').remove();
|
785 |
+
}
|
786 |
+
}
|
787 |
+
return this;
|
788 |
+
}
|
789 |
|
790 |
|
791 |
+
Largeimage.prototype.setposition = function () {
|
792 |
+
this.node.style.left = Math.ceil(-scale.x * parseInt(lens.getoffset().left) + bleft) + 'px';
|
793 |
+
this.node.style.top = Math.ceil(-scale.y * parseInt(lens.getoffset().top) + btop) + 'px';
|
794 |
+
};
|
795 |
|
796 |
+
//setto la posizione dell'immagine grande nel caso di innerzoom
|
797 |
+
Largeimage.prototype.setinner = function (e) {
|
798 |
+
this.node.style.left = Math.ceil(-scale.x * Math.abs(e.pageX - smallimagedata.pos.l)) + 'px';
|
799 |
+
this.node.style.top = Math.ceil(-scale.y * Math.abs(e.pageY - smallimagedata.pos.t)) + 'px';
|
800 |
+
$('div.jqZoomPup img', a).css({'position': 'absolute', 'top': this.node.style.top, 'left': this.node.style.left });
|
801 |
+
};
|
802 |
|
|
|
|
|
803 |
|
804 |
+
Largeimage.prototype.setcenter = function () {
|
805 |
+
this.node.style.left = Math.ceil(-scale.x * Math.abs((smallimagedata.w) / 2)) + 'px';
|
806 |
+
this.node.style.top = Math.ceil(-scale.y * Math.abs((smallimagedata.h) / 2)) + 'px';
|
807 |
|
|
|
|
|
|
|
808 |
|
809 |
+
$('div.jqZoomPup img', a).css({'position': 'absolute', 'top': this.node.style.top, 'left': this.node.style.left });
|
810 |
+
};
|
|
|
|
|
|
|
811 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
812 |
|
813 |
+
//STAGE
|
814 |
+
function Stage() {
|
|
|
|
|
815 |
|
816 |
+
var leftpos = smallimagedata.pos.l;
|
817 |
+
var toppos = smallimagedata.pos.t;
|
818 |
+
//creating element and class
|
819 |
+
this.node = document.createElement("div");
|
820 |
+
$(this.node).addClass('jqZoomWindow');
|
821 |
|
822 |
+
$(this.node)
|
823 |
+
.css({
|
824 |
+
position: 'absolute',
|
825 |
+
width: Math.round(settings.zoomWidth) + 'px',
|
826 |
+
height: Math.round(settings.zoomHeight) + 'px',
|
827 |
+
display: 'none',
|
828 |
+
zIndex: 10000,
|
829 |
+
overflow: 'hidden'
|
830 |
+
});
|
831 |
|
832 |
+
//fa il positionamento
|
833 |
+
switch (settings.position) {
|
834 |
+
case "right":
|
835 |
|
836 |
+
leftpos = (smallimagedata.pos.r + Math.abs(settings.xOffset) + settings.zoomWidth < screen.width)
|
837 |
+
? (smallimagedata.pos.l + smallimagedata.w + Math.abs(settings.xOffset))
|
838 |
+
: (smallimagedata.pos.l - settings.zoomWidth - Math.abs(settings.xOffset));
|
839 |
|
840 |
+
topwindow = smallimagedata.pos.t + settings.yOffset + settings.zoomHeight;
|
841 |
+
toppos = (topwindow < screen.height && topwindow > 0)
|
842 |
+
? smallimagedata.pos.t + settings.yOffset
|
843 |
+
: smallimagedata.pos.t;
|
844 |
|
845 |
+
break;
|
846 |
+
case "left":
|
847 |
|
848 |
+
leftpos = (smallimagedata.pos.l - Math.abs(settings.xOffset) - settings.zoomWidth > 0)
|
849 |
+
? (smallimagedata.pos.l - Math.abs(settings.xOffset) - settings.zoomWidth)
|
850 |
+
: (smallimagedata.pos.l + smallimagedata.w + Math.abs(settings.xOffset));
|
851 |
|
852 |
+
topwindow = smallimagedata.pos.t + settings.yOffset + settings.zoomHeight;
|
853 |
+
toppos = (topwindow < screen.height && topwindow > 0)
|
854 |
+
? smallimagedata.pos.t + settings.yOffset
|
855 |
+
: smallimagedata.pos.t;
|
856 |
|
857 |
+
break;
|
858 |
+
case "top":
|
|
|
|
|
859 |
|
860 |
+
toppos = (smallimagedata.pos.t - Math.abs(settings.yOffset) - settings.zoomHeight > 0)
|
861 |
+
? (smallimagedata.pos.t - Math.abs(settings.yOffset) - settings.zoomHeight)
|
862 |
+
: (smallimagedata.pos.t + smallimagedata.h + Math.abs(settings.yOffset));
|
863 |
|
864 |
|
865 |
+
leftwindow = smallimagedata.pos.l + settings.xOffset + settings.zoomWidth;
|
866 |
+
leftpos = (leftwindow < screen.width && leftwindow > 0)
|
867 |
+
? smallimagedata.pos.l + settings.xOffset
|
868 |
+
: smallimagedata.pos.l;
|
869 |
|
870 |
+
break;
|
871 |
+
case "bottom":
|
872 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
873 |
|
874 |
+
toppos = (smallimagedata.pos.b + Math.abs(settings.yOffset) + settings.zoomHeight < $('body').height())
|
875 |
+
? (smallimagedata.pos.b + Math.abs(settings.yOffset))
|
876 |
+
: (smallimagedata.pos.t - settings.zoomHeight - Math.abs(settings.yOffset));
|
877 |
|
|
|
|
|
|
|
878 |
|
879 |
+
leftwindow = smallimagedata.pos.l + settings.xOffset + settings.zoomWidth;
|
880 |
+
leftpos = (leftwindow < screen.width && leftwindow > 0)
|
881 |
+
? smallimagedata.pos.l + settings.xOffset
|
882 |
+
: smallimagedata.pos.l;
|
883 |
|
884 |
+
break;
|
885 |
+
default:
|
|
|
|
|
886 |
|
887 |
+
leftpos = (smallimagedata.pos.l + smallimagedata.w + settings.xOffset + settings.zoomWidth < screen.width)
|
888 |
+
? (smallimagedata.pos.l + smallimagedata.w + Math.abs(settings.xOffset))
|
889 |
+
: (smallimagedata.pos.l - settings.zoomWidth - Math.abs(settings.xOffset));
|
890 |
|
891 |
+
toppos = (smallimagedata.pos.b + Math.abs(settings.yOffset) + settings.zoomHeight < screen.height)
|
892 |
+
? (smallimagedata.pos.b + Math.abs(settings.yOffset))
|
893 |
+
: (smallimagedata.pos.t - settings.zoomHeight - Math.abs(settings.yOffset));
|
894 |
|
895 |
+
break;
|
896 |
+
}
|
897 |
+
|
898 |
+
this.node.style.left = leftpos + 'px';
|
899 |
+
this.node.style.top = toppos + 'px';
|
900 |
+
return this;
|
901 |
+
}
|
902 |
|
903 |
|
904 |
+
Stage.prototype.activate = function () {
|
905 |
+
|
906 |
+
if (!this.node.firstChild)
|
907 |
+
this.node.appendChild(largeimage.node);
|
908 |
+
|
909 |
+
|
910 |
+
if (settings.title) {
|
911 |
+
ZoomTitleObj.loadtitle();
|
912 |
+
}
|
913 |
+
|
914 |
+
|
915 |
+
document.body.appendChild(this.node);
|
916 |
+
|
917 |
+
|
918 |
+
switch (settings.showEffect) {
|
919 |
+
case 'show':
|
920 |
+
$(this.node).show();
|
921 |
+
break;
|
922 |
+
case 'fadein':
|
923 |
+
$(this.node).fadeIn(settings.fadeinSpeed);
|
924 |
+
break;
|
925 |
+
default:
|
926 |
+
$(this.node).show();
|
927 |
+
break;
|
928 |
+
}
|
929 |
+
|
930 |
+
$(this.node).show();
|
931 |
+
|
932 |
+
if ($.browser.msie && $.browser.version < 7) {
|
933 |
+
this.ieframe = $('<iframe class="zoom_ieframe" frameborder="0" src="#"></iframe>')
|
934 |
+
.css({ position: "absolute", left: this.node.style.left, top: this.node.style.top, zIndex: 99, width: settings.zoomWidth, height: settings.zoomHeight })
|
935 |
+
.insertBefore(this.node);
|
936 |
+
}
|
937 |
+
;
|
938 |
+
|
939 |
+
|
940 |
+
largeimage.node.style.display = 'block';
|
941 |
+
}
|
942 |
+
|
943 |
+
Stage.prototype.remove = function () {
|
944 |
+
switch (settings.hideEffect) {
|
945 |
+
case 'hide':
|
946 |
+
$('.jqZoomWindow').remove();
|
947 |
+
break;
|
948 |
+
case 'fadeout':
|
949 |
+
$('.jqZoomWindow').fadeOut(settings.fadeoutSpeed);
|
950 |
+
break;
|
951 |
+
default:
|
952 |
+
$('.jqZoomWindow').remove();
|
953 |
+
break;
|
954 |
+
}
|
955 |
+
}
|
956 |
+
|
957 |
+
function zoomTitle() {
|
958 |
+
|
959 |
+
this.node = jQuery('<div />')
|
960 |
+
.addClass('jqZoomTitle')
|
961 |
+
.html('' + ZoomTitle + '');
|
962 |
+
|
963 |
+
this.loadtitle = function () {
|
964 |
+
if (settings.zoomType == 'innerzoom') {
|
965 |
+
$(this.node)
|
966 |
+
.css({position: 'absolute',
|
967 |
+
top: smallimagedata.pos.b + 3,
|
968 |
+
left: (smallimagedata.pos.l + 1),
|
969 |
+
width: smallimagedata.w
|
970 |
+
})
|
971 |
+
.appendTo('body');
|
972 |
+
} else {
|
973 |
+
$(this.node).appendTo(stage.node);
|
974 |
+
}
|
975 |
+
};
|
976 |
+
}
|
977 |
+
|
978 |
+
zoomTitle.prototype.remove = function () {
|
979 |
+
$('.jqZoomTitle').remove();
|
980 |
+
}
|
981 |
+
|
982 |
+
|
983 |
+
function Loader() {
|
984 |
+
|
985 |
+
this.node = document.createElement("div");
|
986 |
+
$(this.node).addClass('preload');
|
987 |
+
$(this.node).html(settings.preloadText);//appendo il testo
|
988 |
+
|
989 |
+
$(this.node)
|
990 |
+
.appendTo("body")
|
991 |
+
.css('visibility', 'hidden');
|
992 |
+
|
993 |
+
|
994 |
+
this.show = function () {
|
995 |
+
switch (settings.preloadPosition) {
|
996 |
+
case 'center':
|
997 |
+
loadertop = smallimagedata.pos.t + (smallimagedata.h - $(this.node).height()) / 2;
|
998 |
+
loaderleft = smallimagedata.pos.l + (smallimagedata.w - $(this.node).width()) / 2;
|
999 |
+
break;
|
1000 |
+
default:
|
1001 |
+
var loaderoffset = this.getoffset();
|
1002 |
+
loadertop = !isNaN(loaderoffset.top) ? smallimagedata.pos.t + loaderoffset.top : smallimagedata.pos.t + 0;
|
1003 |
+
loaderleft = !isNaN(loaderoffset.left) ? smallimagedata.pos.l + loaderoffset.left : smallimagedata.pos.l + 0;
|
1004 |
+
break;
|
1005 |
+
}
|
1006 |
+
|
1007 |
+
//setting position
|
1008 |
+
$(this.node).css({
|
1009 |
+
top: loadertop,
|
1010 |
+
left: loaderleft,
|
1011 |
+
position: 'absolute',
|
1012 |
+
visibility: 'visible'
|
1013 |
+
});
|
1014 |
+
}
|
1015 |
+
return this;
|
1016 |
+
}
|
1017 |
+
|
1018 |
+
Loader.prototype.getoffset = function () {
|
1019 |
+
var o = null;
|
1020 |
+
o = $('div.preload').offset();
|
1021 |
+
return o;
|
1022 |
+
}
|
1023 |
+
|
1024 |
+
});
|
1025 |
+
}
|
1026 |
+
})(jQuery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package.xml
CHANGED
@@ -1,26 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>CueBlocks_Zoom</name>
|
4 |
-
<version>3.0.
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>
|
10 |
-
<description>
|
11 |
-
<notes>
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-

|
17 |
-

|
18 |
-

|
19 |
-
3)This extension will work for simple,configurable,bundled,virtual and grouped products.</notes>
|
20 |
-
<authors><author><name>CueBlocks</name><user>auto-converted</user><email>pancham@cueblocks.com</email></author></authors>
|
21 |
-
<date>2012-04-10</date>
|
22 |
-
<time>12:22:29</time>
|
23 |
-
<contents><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="zoom.xml" hash="d26d7e72f9fe961518f17fcd639857e4"/></dir><dir name="template"><dir name="zoom"><file name="media.phtml" hash="ecc5b425136a2550dfbb594dd49ec2c1"/></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="JM"><dir name="Zoom"><dir name="etc"><file name="config.xml" hash="8c46c520b1899ff8cd446ac0ca6e1e99"/></dir><dir name="Helper"><file name="Data.php" hash="14c2a90f6abab3694421dee276104911"/></dir></dir><file name="readme.txt" hash="b656f167e5de72c8eaec2eb58b9027d3"/></dir></target><target name="mage"><dir name="js"><dir name="CBjquery"><file name="Cuejqzoom.js" hash="503f694f98da00896d0e79f37c772d3b"/><file name="jquery-1.5.2.min.js" hash="af72eea89865d0ce07d6ad2f7588c99d"/><file name="jquery.jqzoom1.0.1.js" hash="e15445b6384c0be0b55b6d9b3f873867"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="JM_Zoom.xml" hash="95fa53851cbeedc95f67ded87008ed29"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="jqzoom.css" hash="6b12d033e477ead2050d9d5cd58d7185"/></dir><dir name="images"><file name="zoomloader.gif" hash="7b9776076d5fceef4993b55c9383dedd"/></dir></dir></dir></dir></target></contents>
|
24 |
<compatible/>
|
25 |
<dependencies/>
|
26 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>CueBlocks_Zoom</name>
|
4 |
+
<version>3.0.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>Product Zoom Extension</summary>
|
10 |
+
<description>The extension replaces the default zoom slider under the main image box with jQuery zoom. The user can mouse-over the image and the larger image view of that particular area shows up on the screen next to the main image (user can magnify a specific part of the image without having to open the images in a new window). Also, all images under "More Views" load on the product page itsef and make use of the localized zoom function of the extension. Installation will take approximately 5 minutes.</description>
|
11 |
+
<notes>moved files (template/layout and skin ) to base theme</notes>
|
12 |
+
<authors><author><name>Francesco Magazzu'</name><user>auto-converted</user><email>magento@cueblocks.com</email></author></authors>
|
13 |
+
<date>2013-05-01</date>
|
14 |
+
<time>07:18:12</time>
|
15 |
+
<contents><target name="mageetc"><dir name="modules"><file name="CueBlocks_Zoom.xml" hash="0d477a5b9129a68846095097db5c4200"/></dir></target><target name="mageweb"><dir name="js"><dir name="CBjquery"><file name="Cuejqzoom.js" hash="3c58bdffc834675eccb95a87d9cccd8e"/><file name="jquery-1.5.2.min.js" hash="af72eea89865d0ce07d6ad2f7588c99d"/><file name="jquery.jqzoom1.0.1.js" hash="e9f4b7aa0448b0ed364c766b21e5a4d0"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="zoom"><file name="media.phtml" hash="fc688a1154c2cbfa9c87a1cd4bb5303f"/></dir></dir><dir name="layout"><file name="zoom.xml" hash="5b7c142d407272640d28342c3ebd020c"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="jqzoom.css" hash="6b12d033e477ead2050d9d5cd58d7185"/></dir><dir name="images"><file name="zoomloader.gif" hash="7b9776076d5fceef4993b55c9383dedd"/></dir></dir></dir></dir></target><target name="magecommunity"><dir name="CueBlocks"><dir name="Zoom"><dir name="Helper"><file name="Data.php" hash="ef55ad84540bac0d4ef64a38faa32e6f"/></dir><dir name="etc"><file name="config.xml" hash="84c5f8be340643119dbd8633ea270c15"/></dir><file name="readme.txt" hash="340d528f4b784b4794763592f070ad0d"/></dir></dir></target></contents>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|
skin/frontend/{default → base}/default/css/jqzoom.css
RENAMED
File without changes
|
skin/frontend/{default → base}/default/images/zoomloader.gif
RENAMED
File without changes
|