Drupal is a registered trademark of Dries Buytaert
drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). eca 3.1.1 Minor update available for module eca (3.1.1). layout_paragraphs 2.1.3 Minor update available for module layout_paragraphs (2.1.3). ai 1.3.3 Minor update available for module ai (1.3.3). ai 1.2.14 Minor update available for module ai (1.2.14). node_revision_delete 2.0.3 Minor update available for module node_revision_delete (2.0.3). moderated_content_bulk_publish 2.0.52 Minor update available for module moderated_content_bulk_publish (2.0.52). klaro 3.0.10 Minor update available for module klaro (3.0.10). klaro 3.0.9 Minor update available for module klaro (3.0.9). layout_paragraphs 2.1.2 Minor update available for module layout_paragraphs (2.1.2). geofield_map 11.1.8 Minor update available for module geofield_map (11.1.8).

Provides ZURB Foundation based dynamic anchor menu blocks, dynamically generated based on contents of the current page by classes and data attributes.

Allows flexible anchor / jump menus scrolling to specific page sections. Especially helpful on One-page sites and for long contents.

Dependencies

Functionality

The module collects anchor targets from the content with Javascript and adds them to the Zurb Foundation Magellan anchor menu (https://get.foundation/sites/docs/magellan.html).

Also it provides a block type "Anchor Custom Block", with the fields:

  • ID: The anchor target id.
  • Title: The readable title added to the menu, if no title is given, the anchor will not be added to the dynamic anchor menu.

This block acts as scroll-target and data source for the dynamic anchor menu.

Installation & use

Important for Composer installation: See the composer installation instructions on https://www.drupal.org/project/foundation_sites
Also see Downloading third-party libraries using Composer.

The module depends on asset-packagist!

  1. Install the module as usual: https://www.drupal.org/docs/8/extending-drupal-8/installing-drupal-8-mod...
  2. Go to your block configuration page and add the "Dynamic Anchor Menu Block"
  3. Add anchor targets by block, custom markup, ... (see possibilities described beyond)

Add anchors by block

Add some "Anchor Custom Block"'s in the block configuration page, in Layout Builder, ...

Embed anchors in WYSIWYG

The module also creates an entity embed button for the CKEditor, you just need to add the button in your WYSIWYG configuration page (/admin/config/content/formats). Furthermore an entiy browser for Anchor Custom Blocks will be created.

Add anchors manually in HTML

The element just requires the following attributes:

<div id="my-custom-anchor-target" data-magellan data-magellan-target="my-custom-anchor-target" data-anchor-menu-title="My Custom Anchor Target"></div>

Javascript callback functions

"famb:init"

Example Usage:

      $(document).on('famb:init', function(event, anchorMenuObj){
        // Remove anchor menu block if empty
        if(!$(anchorMenuObj).children().length){
          $(anchorMenuObj).parents('.block:first').remove();
        }
      });

Not using Foundation, but Bootstrap or something similar?

Feel free to create an issue, fork this module, use similar classes and names or create a patch to make the functionality available for other UI frameworks!

Development proudly sponsored by:

Activity

Total releases
1
First release
Jun 2025
Latest release
9 months ago
Release cadence
Stability
100% stable

Releases

Version Type Release date
1.1.13 Stable Jun 26, 2025