1

I am trying (and failing) to use the jquery overlay plugin from the jquery_plugin module in Drupal 7.

I am using drupal_add_library() to add the plugin and drupal_add_js to add the code to generate the overlays.

The overlay trigger elements are area elements within a map.

Whenever I try and trigger the overlays, I get nothing - no errors or stacktraces or alerts, or messages in Firebug.

Here is the code - added directly into the page content.

drupal_add_library('jquery_plugin', 'overlay');
drupal_add_js('function($) {
    $(document).ready( function() {
        $(".overlayarea").overlay();
    });
}(jQuery); ','inline');

The map looks as the following:

<map name="globalmap">
    <area id="toronto" class="overlayarea" alt="Toronto" coords="94,195,6" shape="circle" rel="#tor_overlay" nohref />
    <area id="oxford" class="overlayarea" alt="Oxford" coords="576,147,6" shape="circle" rel="#oxf_overlay" nohref />
</map>
1

Actually this module seems to be abandoned. Using drupal_add_library() works only if the module used hook_library(). I wanted to check it in the repository of jquery_plugin, but these files aren't available. I don't know why.

If you want to use overlays, you can use directly the jQuery UI that is already included in Drupal 7.

  • If I remove the drupal_add_library call, Firebug informs me that overlay() is not a function (i.e. not included). Does that mean you have to include the script as suggested by @czervik? – Paul Barrett Aug 26 '11 at 9:16
0

I fixed this by using the Colorbox module and the Imagemap plugin for TinyMCE. Adding class="colorbox' to the map area allowed me to use an overlay for that area.

0

I'm not familiar with using the jQuery plugin module; personally I simply add whatever I need to my theme.info file.

    scripts[] = js/jquery-tools1.42/jquery.tools.min.js

Then overlays are available sitewide.

  • I have added other js files this way with no problems. If this is the answer, what is the point of the plugin module? – Paul Barrett Aug 24 '11 at 14:35
  • The plugin module lets modules reuse a jquery plugin. If you want the overlay to be a theme-independent feature, it is very useful. Try the Libraries module for D7. – Capi Etheriel Sep 24 '11 at 0:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.