• Resolved Dan Stramer

    (@danstramer)


    Hi

    I would like to create a modal popup using the inline feature. Since I have 3 modals in the page I would like to have an option to navigate between them once the first one is open – arrows right and left.
    Similar to when images are opened in a light box.

    Is this possible?
    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author FirelightWP

    (@firelightwp)

    Hey Dan,

    So this is possible but a bit cumbersome right now. Basically when Fancybox looks for links to open, it will check if they have a rel=”gallery” attribute on the link. If so, it will group them together and allow you to navigate between them. This will work for images as well as inline content.

    So for links to open modals, you need to add rel=”gallery” TO THE LINK.

    The question is how to add that. If you are working in html, it is obviously very easy. It might just look like this:

    <a href="#modal1" class="fancybox-inline" rel="gallery">Open Modal 1</a>
    <a href="#modal2" class="fancybox-inline" rel="gallery">Open Modal 2</a>

    If you are working in the block editor, though, it is is not easy to add an attribute like this to the link. There are plugins like https://www.ads-software.com/plugins/attributes-for-blocks/ that allow you to add attributes to blocks. But if you add a paragraph block, and then convert text to a link, and then use the plugin above to add attributes to the block, the attribute will be added to the p tag, not the a tag, and it needs to be on the a tag.

    Obviously you can always find a way in WordPress, and this isn’t rocket science. But it depends on how your adding content.

    I should build an easier way to add fancybox classes and attributes to relevant blocks. I’ll add that to my list of feature requests.

    Thread Starter Dan Stramer

    (@danstramer)

    Thank you very much. I’ll give it a try and let you know how it goes.
    adding this feature would be great!

    Dan

    Thread Starter Dan Stramer

    (@danstramer)

    Hi,

    I Tried your suggestion and it worked.
    Had to add the rel=”gallery” via a php function to the link (replacing a rel=”nofollow” with rel=”gallery”), since the theme allows adding a limited set of rel’s.

    Would be great to have a built in function with Firelight Lightbox. (not just for rel=”galllery” but maybe also for custom rel’s.)

    Thanks for your support,

    Dan

    Plugin Author FirelightWP

    (@firelightwp)

    Hey Dan – Great! Glad you got this worked out.

    And yes, we are thinking the same way about making it easier to add custom rels. When doing that, I may also add the ability to add other custom attributes (like data-fancybox-group) which are used in various situations.

    For now, since we’ve resolved this immediate issue, I’m going to mark this resolved. If I get the features above added in the relative near future, I’ll also follow up here.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.