Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Varbase FAQs 9.2.1 Minor update available for module varbase_faqs (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

This module creates dynamic anchor menus using ZURB Foundation, allowing users to create jump links to different sections of a page. It automatically identifies anchor targets based on page content or through custom anchor blocks.

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();
        }
      });

Additional modules

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
1 year ago
Releases (12 mo)
0 ▼ from 1
Maintenance
Dormant

Releases

Version Type Release date
1.1.13 Stable Jun 26, 2025