Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Superfish Menu not initializing - SOLVED!


Reply


6 Posts   3208 Views

Avatar
Pix

Community Member, 147 Posts

24 December 2010 at 9:28am

First of all, Happy Holidays everyone!

So I've been trying to implement the Superfish menu on my site, I've seen where a couple people were able to do that. The menu shows up, styling is all nice, it's just definitely not super and there is no fishiness about it. In my Page.php, I have under the init function:

Requirements::themedCSS('superfish');
Requirements::javascript('mysite/javascript/lib/superfish.js');
Requirements::javascript('mysite/javascript/lib/hoverIntent.js');
Requirements::javascript('mysite/javascript/lib/jsjquery-1.2.6.min.js');
Requirements::customScript("
   $(document).ready(function() {
   $('ul.sf-menu').superfish();
   });
");

It doesn't seem to initialize. So then I tried moving the document.ready between the <head> tags on Page.ss as I have seen some people do, and still nothing. I've ready somewhere about jQuery 'noConflict', have no idea what that is but could that have something to do with it? Does anyone have any suggestions or pointers?

Thanks!

Avatar
Pix

Community Member, 147 Posts

27 December 2010 at 6:35pm

Anyone have any idea about this?

Avatar
Pix

Community Member, 147 Posts

28 December 2010 at 3:08pm

Hello? Anyone anyone please! Surely someone is using this menu with SilverStripe and has it working?

Avatar
Pix

Community Member, 147 Posts

29 December 2010 at 9:16am

Edited: 29/12/2010 9:18am

Once upon a time there was a developer who decided to build a website with SilverStripe. He liked SilverStripe very much and his website was coming along swimmingly. He was so very happy, it was almost done, and then he thought to himself "Maybe I will also use this SuperFish menu on my site!". Try as he might, he could not get the SuperFish menu to initialize. He put document.ready here, he put document.ready there, the menu would not initialize, it would not initialize anywhere. So the developer thought to himself "I will post a question on the SilverStripe forum, where come and go people of great SilverStripe knowledge!" And so he did, and he waited for an answer. He waited and waited for any tips. He waited and waited and waited....

The end?

Avatar
Pix

Community Member, 147 Posts

29 December 2010 at 11:57am

...and still he waited and waited with no answer in site, not even a hint! The people of great SilverStripe knowledge just passed him by, some even scoffed and sneered "You'll never get your fishy menu working, silly noob!". But the developer did not give up! He searched and searched and just when all seemed lost he found something that worked! Instead of this in Page.php:

Requirements::customScript("
$(document).ready(function() {
$('ul.sf-menu').superfish();
});
");

Hi did THIS:

Requirements::customScript("
;(function($) {
$(function(){
$('ul.sf-menu').superfish();
});
})(jQuery);
");

and the menu became fishy. Not just fishy but SUPER fishy! The developer celebrated with large amounts of beer and pizza and lived happily ever after.

The End

Avatar
weisdaclick

Community Member, 21 Posts

20 March 2012 at 11:32am

I would really like to know how to do this.

I have installed the Superfish module - nothing shows up when I run the /dev/build so I have no idea if it is correctly installed.

I have found crumbs here and there of how to implement superfish menus and I have tried them but nothing seems to work.

Can you post a (noob's) guide on how you did it?