Title: Trigger Lightbox from Menu?
Last modified: January 5, 2021

---

# Trigger Lightbox from Menu?

 *  [davidkurz](https://wordpress.org/support/users/davidkurz/)
 * (@davidkurz)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/trigger-lightbox-from-menu/)
 * dear community,
 * i have a problem with a wordpress-site, which i can’t solve. Maybe you have any
   tips for me. Is it possible to trigger the first element of an lightbox-group-
   link (ModuloBox Plugin) from the wordpress menu? The links are like this:
 * `<a id="nomestart" class="mobx" href="http://www.testurl.at/testbild.jpg" data-
   rel="nomegroup"><img class="alignnone wp-image-1829" src="http://www.testurl.
   at/testbild.jpg"/></a>`
 * I thought, i can trigger the link with the ID `#nomestart` with javascript, but
   it doesn’t work for me or i miss something. i tried serveral things (Plugin JinMenu,
   different scripts in the header,…). Any tips ?
 * regards, david
    -  This topic was modified 5 years, 5 months ago by [davidkurz](https://wordpress.org/support/users/davidkurz/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [corrinarusso](https://wordpress.org/support/users/corrinarusso/)
 * (@corrinarusso)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/trigger-lightbox-from-menu/#post-13869006)
 * Sure – did you add the jQuery and the Lightbox to your page ?
    Suggest making
   sure it works in a “regular page” before adding to the menu.
 * This is a different plugin, but the theory should apply the same way :
    [http://lightbox.tipsandtricks-hq.com/open-lightbox-from-wordpress-menu/](http://lightbox.tipsandtricks-hq.com/open-lightbox-from-wordpress-menu/)
 * There is also other approaches to use a shortcode in a cusomt link :
     which 
   you could use from ModuloBox
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/trigger-lightbox-from-menu/#post-13873281)
 * I believe what triggers the lightbox is the `data-rel` attribute value. I’m unsure
   if there are additional requirements. You could modify the normal nav menu element’s
   anchor tag to include the attribute through the “wp_nav_menu” filter. Use `str_replace()`
   to find a distinct sub-string in the target tag and replace it with the same 
   + the required attribute.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Trigger Lightbox from Menu?’ is closed to new replies.

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [onclick](https://wordpress.org/support/topic-tag/onclick/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 2 replies
 * 3 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [5 years, 5 months ago](https://wordpress.org/support/topic/trigger-lightbox-from-menu/#post-13873281)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
