本文介绍了Magento原型错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
出现此错误:
prototype.js:5653 Uncaught TypeError: element.attachEvent is not a function
prototype.js:2304 Uncaught TypeError: Cannot read property 'length' of undefinedElement.Methods.hasClassName
prototype.js:5653 Uncaught TypeError: element.attachEvent is not a function
prototype.js:5653 Uncaught TypeError: element.attachEvent is not a function
prototype.js:5644 Uncaught TypeError: element.attachEvent is not a function
prototype.js:5734 Uncaught TypeError: element.dispatchEvent is not a function
kam-black-cargo-trousers-38-inch-leg:2904 Uncaught TypeError: $(...).fancybox is not a function
我认为这可能是jquery冲突问题,有人可以建议检查吗?
I think it could be a jquery conflict problem, could anyone suggest anything to check.
在这里调用Fancybox代码:
The Fancybox code is being called here:
$('.sm_quickview_handler').fancybox({
title: null,
width : '75%',
height : '90%',
autoSize : 1,
scrolling : 'auto',
type : 'ajax',
openEffect : 'fade',
closeEffect : 'fade',
helpers :{
overlay : {
showEarly : true
}
},
beforeShow : function(){
var $this = this.element, _parent = $('.quickview-main');
if(_parent.length > 0 ){
var _price_box = _parent.find('.price-box');
if(_price_box.length > 0){
if($('[id]',_price_box).length > 0){
$('[id]',_price_box).each(function(i, el){
var id_price = $(el).attr('id');
$(el).attr('data-idprice',id_price );
$(el).attr('id',id_price+'_clone');
});
}
}
}
if(typeof product_zoom){
product_zoom = 'undefined';
}
},
afterShow : function(){
if( _check_tem_def){
product_zoom_ = new Product.Zoom('image', 'track', 'handle', 'zoom_in', 'zoom_out', 'track_hint');
}
if(_ceck_tem_rwd){
ProductMediaManager.initZoom();
ProductMediaManager.wireThumbnails();
}
if(typeof initcajax != 'undefined' && $.isFunction(initcajax)){
initcajax();
}
if(typeof updateProductCompareLinks != 'undefined' && $.isFunction(updateProductCompareLinks)){
updateProductCompareLinks();
}else{
$("a.link-compare").on ("click",function(e){
e.preventDefault();
urlcompare = $(this).attr("href");
urlcompare = urlcompare.replace("catalog/product_compare/add","quickview/index/compare");
window.location = urlcompare;
return false;
});
}
if(typeof updateWishlistLinks != 'undefined' && $.isFunction(updateWishlistLinks)) {
if(enable_ajax_wishlist){
updateRemoveWishLinks();
if(islogin=="1"){
//setInterval("updateWishlistLinks()",100);}
updateWishlistLinks();
}
updateWishlistAddCartLinks();
}
}
},
beforeClose : function () {
if( _check_tem_def){
product_zoom_ = 'undefined';
}
if(_ceck_tem_rwd){
ProductMediaManager.destroyZoom();
}
},
afterClose : function(){
}
});
setInterval(function(){ _SmQuickView(); } ,1000);
});
关于可能是什么导致该功能不起作用的任何想法?
Any ideas on what it could be thats causing this not to work?
谢谢
推荐答案
在fancybox jQuery启动之前放置以下行.
Place the following line before your fancybox jquery start.
jQuery.noConflict();
全部用jQuery替换所有$
All Replace all $ with jQuery
谢谢
这篇关于Magento原型错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!