Magento prototype error

advertisements

Getting this error:

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

I think it could be a jquery conflict problem, could anyone suggest anything to check.

EDIT:

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?

Thanks


Try running jQuery in no conflict mode. This will stop any potential conflicts with Prototype.

https://api.jquery.com/jquery.noconflict/

Then to get Fancy box working use jQuery instead of $. So

jQuery('.sm_quickview_handler').fancybox.....