4

I often use RokBox to open content in a modal window, and it works by adding data-rokbox to the <a> tag:

<a data-rokbox href="/images/my_image.jpg">This is a RokBox 2 Link</a>

But how can I create a menu item that opens a link in a modal window using the Joomla menu manager? In earlier versions of Joomla (not sure how far back this worked) it was possible by creating an external link, and trick Joomla into adding data-rokbox by adding your link like this:

External URL with RokBox

(Note the additional quotation marks).

This does not work anymore because the quotation marks are filtered out upon saving.

Are there any good ideas as to how I can make this work?

  • 3
    hello Johnpw, back in time I have suggested the modals plugin by Nonumber joomla.stackexchange.com/questions/91/…... Haven't tried recently, but I guess you could give your menu item a specific class and have modals plugin open this class in modal. Give it a try and let us know how it goes. – FFrewin Nov 28 '15 at 6:36
  • FFrewin's suggestion is the correct answer. I am using a similar setup to open a livechat box if it is during normal business hours for one of my client sites. Set a css class for the menu item, then add some jquery to fire the modal event you want to use (rokbox, fancybox, etc) – Terry Carter Feb 5 '16 at 0:50
4

back in time I have suggested the modals plugin by Nonumber in a same question question: How can I make a modal menu item?.

I Haven't tried recently, but I guess you could give your menu item a specific class and have modals plugin open this class in modal easily.

From NoNumbers Modal Plugin Documentation:

Open menu items in modals

To make a menu item open in a modal popup, simply surround the menu title in {modal} tags.

So if your menu item title is Click here!, change it to {modal}Click here!{/modal}.

You can also pass extra variables in the tag as described earlier, like: {modal title=My Page}Click here!{/modal} or {modal width=600|height=400}Click here!{/modal}.

If for some reason you don't want to use the {modal} tags (or it doesn't work), you can also give the menu item a custom classname (works with most menu modules) and set Modals up to convert by that classname.

1

@FFrewin This solution would work if you were custom coding a menu, but having a pre-built menu modules more than likely would not work since the menu is dynamically generated unless you modified the code. Your comment on the OP question about using a CSS class is indeed the correct method of firing a modal event form a menu item.

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.