javascript 类型错误:image.elevateZoom 不是函数:Magento 1.9 RWD 主题失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24646559/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
TypeError: image.elevateZoom is not a function: Failure in Magento 1.9 RWD theme
提问by Haris
In Magento 1.9 CE, if we browse the product reviews page, it displays an error
在 Magento 1.9 CE 中,如果我们浏览产品评论页面,它会显示错误
TypeError: image.elevateZoom is not a function
类型错误:image.elevateZoom 不是函数
This is because, magento is zooming image in product page using this plugin
这是因为,magento 正在使用此插件放大产品页面中的图像
the JavaScript interpreter, because of a failure shuts down on this page, JavaScript is not executed. This leads to decreased functionality of the page.
JavaScript 解释器,因为在这个页面上关闭失败,JavaScript 不会被执行。这会导致页面功能下降。
Can anyone help me on how to remove this error so that I can use js on this page?
谁能帮我解决这个错误,以便我可以在这个页面上使用 js?
Theseguys say they have solved the problem, but I can't get the solution.
这些人说他们已经解决了问题,但我无法得到解决方案。
I have asked the same question on Magento Stack.
我在 Magento Stack 上问过同样的问题。
采纳答案by Ricky Odin Matthews
I've got the same issue - not that it's a complete solution but it certainly stops the error for now, by stopping the function being called on the review page.
我遇到了同样的问题 - 不是说它是一个完整的解决方案,但它现在肯定会停止错误,方法是停止在评论页面上调用的函数。
in the file /skin/frontend/rwd/default/js/app.js
在文件 /skin/frontend/rwd/default/js/app.js 中
line 649 change
649线变化
image.elevateZoom();
to
到
if ($('.review-product-list').length == 0) {
image.elevateZoom();
}
回答by Julie Carlson
We just ran across this for a client. This was resolved by changing the script being referenced from the min version to the full version. So replace this:
我们刚刚为一个客户遇到了这个问题。这是通过将引用的脚本从最小版本更改为完整版本来解决的。所以替换这个:
<action method="addItem"><type>skin_js</type>
<script>js/lib/elevatezoom/jquery.elevateZoom-3.0.8.min.js</script>
</action>
With this:
有了这个:
<action method="addItem"><type>skin_js</type>
<script>js/lib/elevatezoom/jquery.elevateZoom-3.js</script>
</action>
The error resolved and zoom is working.
错误已解决,缩放工作正常。
回答by Sushant Vishwas
Open app/design/frontend/your-package/your-theme/template/catalog/product/view/media.html
Comment below section of code
app/design/frontend/your-package/your-theme/template/catalog/product/view/media.html
在代码部分下方打开评论
<!-- <script type="text/javascript">
// <![CDATA[
Event.observe(window, 'load', function() {
product_zoom = new Product.Zoom('image', 'track', 'handle', 'zoom_in', 'zoom_out', 'track_hint');
});
//]]>
</script> -->
回答by zheek
I had a same problem and after a long search I use this code and every thing works well . I use var $j = jQuery.noConflict();
before elevateZoom
function .
我遇到了同样的问题,经过长时间的搜索,我使用了此代码,并且一切正常。我使用var $j = jQuery.noConflict();
beforeelevateZoom
函数。
<script>
// Avoid PrototypeJS conflicts, assign jQuery to $j instead of $
var $j = jQuery.noConflict();
$("#zoom_07").elevateZoom({});
</script>