First off… I just got this and I have to say I’m SUPER impressed. Great job on this.
Here’s my issue.
I’m trying to create a button within Beaver Builder that will trigger content in a lightbox.
Specifically… The button says “Get a Quote!”. When the user clicks that button, I want a form to open in a lightbox.
I know how to do it via HTML code. I specifically want to trigger it via the Beaver Builder button so I don’t have to hand-code button styles.
I own FooBox so I can use that if necessary. Any suggestions for how to make this happen?
Alright… I found an ultra-janky work-around. Basically I use an image for the button and load it in via an HTML module. This lets me specify target=“foobox” in the anchor tag.
Here’s a small change that would make BB a TON more flexible for future versions…
Let me set a custom target other than “same window” and “new window” for links and buttons. That way I can load whatever content I want through my third-party lightbox plugin.
…Unless I’m missing something. Is there a better way?
Welcome to the BB forums!
I’m glad you’re loving the plugin! I don’t really think the guys are going to be implementing such feature but feel free to head over to our user voice forums if you want to add a request for that.
So the only thing you want is to be able to add an additional target for your foobox. I think we can do that via JS. The code below should be able to do it. You’ll want to assign a class to your button first so it doesn’t apply to all anchor tags. In this example, the class used is request-a-quote.
jQuery('.request-a-quote a').attr('target', 'foobox');
If you’re using the BB theme, you can simply place this under Theme Customizer > Code > JS Code.
Hope this helps!
First off, thanks for the prompt response! I really appreciate it. I’m using the BB theme.
Instead of opening in FooBox, it causes it to open in a new window. This happens with both the code above and my own…
I’m not necessarily bent on using FooBox. Do you have any suggestions for getting my “get a quote” form to load in a lightbox using BB?
That makes sense! Sorry but BB seems to not have that option. You might want to make a feature request about it though, a Modal Popup module.