Access denied. You must login to view this page.

Adjusting superfish behaviour

Please register or log in to post to the forums
4 replies [Last post]
MF82
MF82's picture
Offline
Joined: 2010-08-17
Posts: 5
Adjusting superfish behaviour

Hi!

A few weeks ago I dived into Fusion. I'm implementing a design in a new subtheme and one the requirements of the designer is that the second level menu remains visible after clicking the menu item. I thought this would be a nice use case to implement the nav-bar style superfish menu. The nav-bar style works, however the second level keeps disappearing. Here's what I did:

Created a template.php in my sub theme folder and inserted the code listed on this page http://fusiondrupalthemes.com/support/theme-developers/special-features (heading "Changing the Superfish layout"). That worked perfectly!

For the second level menu, I tried to implement suggested on this page http://users.tpg.com.au/j_birch/plugins/superfish/#sample4 where it is says to use the pathClass option of the superfish plugin. As indicated on your "special features" page, heading "changing the superfish parameters", I tried to implement the pathClass. I created a "script.js file" in the "js" folder of my new subtheme and added the following to the script js file:

Drupal.behaviors.mysubthemeSuperfish = function (context) {

$("#primary-menu ul.sf-navbar").superfish({
    hoverClass:  'sfHover',
    pathLevels:  2,
    pathClass:   'expanded active-trail',
    delay:       250,
    animation:   {opacity:'show',height:'show'},
    speed:       'fast',
    autoArrows:  false,
    dropShadows: false,
    disableHI:   true
  }).supposition();
};

I changed the "fusion" reference to my subtheme in the function name, the div # into ul.sf-navbar and added the pathLevels and pathClass.

I have the feeling i'm close, but obviously missing something. I'm not complete sure which pathClass I should use or if the adjusted parameters are loaded. Could someone point me into the right direction?

Thank you in advance!

Sidney

jeremy
jeremy's picture
Offline
Joined: 2009-06-09
Posts: 740

Superfish is a bit difficult to work with when you need to get the active menu sub-menu to be visible when you are on that section. I've tried a LOT of different scripts and changes to the theme but never found a solution that worked for Superfish and it was very unstabble when I got close to what I wanted.

I actually went with disabling the primary menu and Superfish all together and going with a block instead for my menu. This is basically starting all over and doesn't work with Superfish at all so you have full control over the placement and styling but will have to write it yourself.

So for this specific case I recommend going with a block instead of the default primary menu with Superfish. Best of luck!

MF82
MF82's picture
Offline
Joined: 2010-08-17
Posts: 5

Thanks for your explanation Jeremy!

When you say "go with a block", do you mean that I should install the Superfish module and make this into a menu? Or do you mean a block to visualize the second level menu?

jeremy
jeremy's picture
Offline
Joined: 2009-06-09
Posts: 740

Sorry I wasn't clear about that. I meant to go with the default Primary Menu block instead of using the theme's version of the Primary Menu which integrates with Superfish. So the Primary Menu block will be a normal menu item with no special styling or anything so you would need to enable that and start writing CSS for it to get the dropdowns and menu working as needed.

MF82
MF82's picture
Offline
Joined: 2010-08-17
Posts: 5

Thanks for fast reply Jeremy! I will go with your suggestion.