I have a Fusion sub theme with a superfish menu. When the menu items go down to the bottom of the available screen the menu pushes up. Is there any way to prevent this? It does not happen to menu's on the Superfish example site.

http://dl.dropbox.com/u/30035/bad.png
http://dl.dropbox.com/u/30035/good.png
http://dl.dropbox.com/u/30035/superfish_example.png

Comments

agerson’s picture

Assigned: Unassigned » agerson
Category: bug » support
Status: Active » Closed (fixed)

Its actually a feature, not a bug:

http://users.tpg.com.au/j_birch/plugins/superfish/supposition-test/

To remove it go to script.js in your sub-theme and change:



Drupal.behaviors.cgpsSuperfish = function (context) {
  $("#primary-menu ul.sf-menu").superfish({
    hoverClass:  'sfHover',
    delay:       250,
    animation:   {opacity:'show',height:'show'},
    speed:       'fast',
    autoArrows:  true,
    dropShadows: false,
    disableHI:   true
  }).supposition();
};

Drupal.behaviors.cgpsSuperfishBlocks = function (context) {
  $("div.block ul.sf-menu").superfish({
    hoverClass:  'sfHover',
    delay:       250,
    animation:   {opacity:'show',height:'show'},
    speed:       'fast',
    autoArrows:  true,
    dropShadows: false,
    disableHI:   true
  }).supposition();
};

to



Drupal.behaviors.cgpsSuperfish = function (context) {
  $("#primary-menu ul.sf-menu").superfish({
    hoverClass:  'sfHover',
    delay:       250,
    animation:   {opacity:'show',height:'show'},
    speed:       'fast',
    autoArrows:  true,
    dropShadows: false,
    disableHI:   true
  })
};

Drupal.behaviors.cgpsSuperfishBlocks = function (context) {
  $("div.block ul.sf-menu").superfish({
    hoverClass:  'sfHover',
    delay:       250,
    animation:   {opacity:'show',height:'show'},
    speed:       'fast',
    autoArrows:  true,
    dropShadows: false,
    disableHI:   true
  })
};
agerson’s picture

Assigned: agerson » Unassigned
jeremycaldwell’s picture

Status: Closed (fixed) » Fixed

That is correct agerson, thanks. It is a feature of the Superfish menu but can be disabled by making a change to your theme.

This code appears in Fusion Core's script.js file (/js/script.js) and controls the display of the Superfish menu.

Drupal.behaviors.fusionSuperfish = function (context) {
  $("#primary-menu ul.sf-menu").superfish({
    hoverClass:  'sfHover',
    delay:       250,
    animation:   {opacity:'show',height:'show'},
    speed:       'fast',
    autoArrows:  false,
    dropShadows: false,
    disableHI:   true
  }).supposition();
};

Drupal.behaviors.fusionSuperfishBlocks = function (context) {
  $("div.block ul.sf-menu").superfish({
    hoverClass:  'sfHover',
    delay:       250,
    animation:   {opacity:'show',height:'show'},
    speed:       'fast',
    autoArrows:  false,
    dropShadows: false,
    disableHI:   true
  }).supposition();
};

Notice the ".supposition();" on both of those behaviors, that is what is doing the placement of your menus. Now to adjust this and change it you need to copy the above code to your subtheme's script.js file located in your /js folder. If there isn't one there create one. Now paste the code there and change the two instanced of "Drupal.behaviors.fusion" to "Drupal.behaviors.THEMENAME" where THEMENAME is the name of your theme, info file, and subtheme folder (they are the same).

Then make sure to add the new script file to be called by your theme in the subtheme's .info file.

scripts[] = js/script.js

Then go back to your site and clear the cache and it should reload your site and theme with the updated script.js file and your menu changes.

SuleymanK’s picture

I added this code ion my script.js file to open menus immediately. My script.js is in the .info file.

Drupal.behaviors.inithemeSuperfish = function (context) {
  $("ul.sf-menu").superfish({
    hoverClass: 'sfHover',
    delay: 0,
    animation: {opacity:'none',height:'none'},
    speed: 'fast',
    autoArrows: false,
    dropShadows: false,
    disableHI: true
  }).supposition();
};

I get this error in firebug:
$("#primary_links ul.sf-menu").superfish({hoverClass: "sfHover", delay: 0, animation: {opacity: "none", height: "none"}, speed: "fast", autoArrows: false, dropShadows: false, disableHI: true}).supposition is not a function.

now anyone this issue?

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

priyanka.salunke’s picture

m not getting actually wht to do
plz specify the filename whtever we hv to change

becoz in script .js m nt getting this code

priyanka.salunke’s picture

jst see this file

manos_ws’s picture

Status: Closed (fixed) » Needs review

I think the best solution would be not to disable the supposition effect but to fix it.

The problem is in the supposition.js at the line 52

if (expandUp) {
     $u.css('margin-top',baseline - (menuHeight + offsetTop));
}

which does not considers the current position of the u.

If you change this with this

if (expandUp) {
        var marginTop = baseline - (menuHeight + offsetTop);
        if ( marginTop <  -offsetTop ) 
        {
                marginTop = -offsetTop + 15 ;
         }
        $u.css('margin-top',marginTop);
}

Please review the code. This should be fixed in the fusion core supposition.js in a future update.
I am not familiar with the patching system so I can't write a patch for it.

ManosK
http://websynergy.gr/

pixelpreview@gmail.com’s picture

I have the same problem

Create a file supposition.js on your js folder in your sub-theme
paste the code from the original file in fusion core
comment theses lines

if (expandUp) {
$u.css('margin-top',baseline - (menuHeight + offsetTop));
}

change your site.info and add these line

scripts[]= js/supposition.js

now fusion superfish will use your js file :-)

aquariumtap’s picture

Status: Needs review » Closed (works as designed)
manos_ws’s picture

This issue is not fixed!

A change should be made in fusion supposition.js