Since upgrading to CiviCRM 3.1.4 from 2.2.5, I have been encountering Javascript errors that seem to trace back to Nice Menus - or Superfish in general.

The section of one of the .js files in sites/default/files/js seems to be triggering the error listed in the title in this section of the code:

// Add Superfish to all Nice menus with some basic options.
7326$(document).ready(function() {
7327 $('ul.nice-menu').superfish({
7328 // Add the legacy hover class added for IE.
7329 hoverClass: 'ie-over',
7330 // Disable generation of arrow mark-up.
7331 autoArrows: false,
7332 // Disable drop shadows.
7333 dropShadows: false,
7334 // Mouse delay.
7335 delay: Drupal.settings.nice_menus_options.delay,
7336 // Animation speed.
7337 speed: Drupal.settings.nice_menus_options.speed
7338 // Add in Brandon Aaron’s bgIframe plugin for IE select issues.
7339 // http://plugins.jquery.com/node/46/release
7340 }).find('ul').bgIframe({opacity:false});
7341 $('ul.nice-menu ul').css('display', 'none');
7342}); 

When I disable Nice Menus, all of the Java-based functions in CiviCRM are working. I came across this suggestion from another thread dealing with similar errors stemming from a theme that calls superfish:

To resolving this, just simply change the superfish.js in pixture_reloaded > sf > js folder
$(document).ready(function() {
$('#superfish-inner ul').superfish();
});

to
jQuery(document).ready(function($) {
$('#superfish-inner ul').superfish();
});

Hope that help.

However, I'm not sure how to apply this same thinking to Nice Menus. If I am understanding the issue correctly, it seems that there are two ways of calling superfish actions, and one used by Nice Menus and several other themes are conflicting with CiviCRM.

However, since I'm not a developer, I would welcome any suggestions if I'm going in the wrong direction here.

You can read more about the issues here: http://forum.civicrm.org/index.php/topic,13539.0.html

Comments

add1sun’s picture

This is a jQuery conflict. AFAIK the fix for addressing this in Drupal 7 also works in Drupal 6, so this is something we could go ahead and do. Patches welcome if someone verifies this is cool in D6. http://drupal.org/update/modules/6/7#javascript_compatibility

add1sun’s picture

Title: $("ul.nice-menu").superfish is not a function » jQuery JS compatibility
Status: Active » Needs review
StatusFileSize
new1.74 KB

Patch attached. Please test and report back.

add1sun’s picture

Priority: Normal » Critical

Changing priority for next release.

vordude’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1.72 KB

Had issues applying the patch (the js file had been changed since the patch was created), so I went for a re-roll, It's the same code, with a nod to the D7 way of using jquery.

I'm not able to test the conflict-- But I get it.

vordude’s picture

Version: 6.x-2.1-beta1 » 6.x-2.x-dev
Status: Reviewed & tested by the community » Fixed

Committed to HEAD.

Status: Fixed » Closed (fixed)

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