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?
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.
First off, thanks for the prompt response! I really appreciate it. I’m using the BB theme.
Changing the target via JavaScript after the fact doesn’t work. That was the first thing I tried too. I wrote some similar code (non jQuery) that essentially did the same thing.
Instead of opening in FooBox, it causes it to open in a new window. This happens with both the code above and my own…
The only thing I can figure is that the FooBox plugin is scanning the page for links targeting it and inserting JavaScript based on what it finds. If that’s the case, changing the target after page load is too late.
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?