I am trying to add an image zoom to our Magento EE 1.14.2.1 which apparently was removed by a prior developer. So I found a script called "jqzoom" http://www.myjqueryplugins.com/jquery-plugin/jqzoom which I want to use. I of course have added a call to Jquery in the head.phtml file and also added the call to the needed jqzoom js and css files in the media.phtml file. However now when I view a product detail page I see in the console the below error.
Uncaught TypeError: $(…).jqzoom is not a function
Now on the top of my media.phtml page I have
<!-- Load image zoom code -->
<script type="text/javascript" src="<?php echo Mage::getUrl()?>skin/frontend/bronson/default/js/jquery.jqzoom-core.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo Mage::getUrl()?>skin/frontend/bronson/default/css/jquery.jqzoom.css">
<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function($)
{
/* simple call */
$('.cloud-zoom').jqzoom();
/* more complex call*/
/*var options = {
zoomType: 'standard',
lens:true,
preloadImages: true,
alwaysOn:false,
zoomWidth: 300,
zoomHeight: 250,
xOffset:90,
yOffset:30,
position:'left'
//...MORE OPTIONS
};
$('.cloud-zoom').jqzoom(options); */
});
</script>
At the top of the jquery.jqzoom-core.js file I have
jQuery.noConflict();
(function ($) {
So I am not sure why the site still does not see jqzoom as a function and how to fix?
*********
I updated my media.phtml to the below and no my issue is I do not see any errors in the console but but the image zoom also does not work.
jQuery.noConflict();
then I changed the /* simple call */ to
jQuery('cloud-zoom').jqzoom();
Best Answer
Don't use the dollar, you will have issues since it's
prototype
's baby. Where you call$(...).jqzoom();
, replace it withjQuery(...).jqzoom();
and this should fix your issue (keep the noConflict).