0

I'm getting an error using magento. I'm using this theme http://demo.magentech.com/themes/sm_igame/

The JavaScript error I get is

TypeError: $(...).fancybox is not a function

<anonymous> opstrike.com:3849 m.Callbacks/j() jquery-1.11.1.min.js:2 m.Callbacks/k.fireWith() jquery-1.11.1.min.js:2 .ready() jquery-1.11.1.min.js:2 J() jquery-1.11.1.min.js:2

I searched for TypeError: $(...).fancybox is not a function and found there may be a problem with plugins interfering with my code. So I removed plugins that I wasn't using, but I still have this error.

Can anyone help?

1

You are loading two different jQuery resources: skin/frontend/sm-igame/default/sm/megamenu/js/jquery-1.7.2.min.js skin/frontend/sm-igame/default/js/jquery.1.11.js Which never is a good practice.

Try to deactivate MegaMenu's jQuery loading somewhere in its preferences / configuration.

Also you might want to run jQuery.noConflict since there might be some other frameworks (such as MooTools etc.) that are occupying the $-shorthand for jQuery. When visiting you website I figured that other jQuery calls are throwing "... is not a function" error.

You could also try to open the fancybox-overlay with a jQuery('a > img').fancybox(); instead of $('a > img').fancybox(); ($ = shorthand for 'jQuery').

Nevertheless a code sample or a link to a page where you use fancybox would be helpul.


After I dug a little deeper into your code: I am not sure why you are using such a large, complex JS-function to manipulate the fancybox-relevant links, image urls, and stuff (function _SmQuickView()). This makes it pretty hard to debug since fancybox actually is just a one-liner. Also the beforeShow and afterShow dependencies could probably be handled easier - if they would have to at all, but I'm not sure what you're up to with this.

I tried to scale browser down to mobile size and made the .yt-product-detail . popup-btn visible. And then fancybox using the icon link just works fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.