Fix: TypeError: jQuery(.sf-menu).superfish is not a function

14. September 2015 at 15:40

XHTML

If you’re working with the superfish drop down menu and you’re getting the error message „TypeError: jQuery(.sf-menu).superfish is not a function“ it is possible that you’re loading the jquery script twice, e.g.:

<script type="text/javascript" src="/assets/js/jquery-1.2.6.min.js"></script>
<script type="text/javascript" src="/skin/frontend/default/default/js/jquery-1.11.1.min.js"></script>

Solution 1

Remove the dublicated js-implementation (remove one of this lines)

Solution 2

If you need to include two versions of jquery on the same page because of plugin support or so …
Change the lines

jQuery(function(){
	jQuery('.sf-menu').superfish()
})

to

jQuery(function(){
	$(document).ready(function(){
		jQuery('.sf-menu').superfish()
	});
})

if you get an error like „$(document).ready is not a function“
use:

(function($){
	$(document).ready(function(){
		$('.sf-menu').superfish()
	});
})(jQuery);

Please share this article von facebook & google plus or where you want, thank you!

Daniel Briegert

Daniel Briegert

xing: https://www.xing.com/profile/Daniel_Briegert

More Posts - Website

Follow Me:
TwitterFacebook