Jump to:

23483 Posts in 18976 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Superfish Menu not initializing - SOLVED!

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

Page: 1
Go to End
Author Topic: 3132 Views
  • Pix
    Avatar
    Community Member
    135 Posts

    Superfish Menu not initializing - SOLVED! Link to this post

    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!

  • Pix
    Avatar
    Community Member
    135 Posts

    Re: Superfish Menu not initializing - SOLVED! Link to this post

    Anyone have any idea about this?

  • Pix
    Avatar
    Community Member
    135 Posts

    Re: Superfish Menu not initializing - SOLVED! Link to this post

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

  • Pix
    Avatar
    Community Member
    135 Posts

    Re: Superfish Menu not initializing - SOLVED! Link to this post

    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?

  • Pix
    Avatar
    Community Member
    135 Posts

    Re: Superfish Menu not initializing - SOLVED! Link to this post

    ...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

  • weisdaclick
    Avatar
    Community Member
    21 Posts

    Re: Superfish Menu not initializing - SOLVED! Link to this post

    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?

    3132 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.