-
AuthorPosts
-
April 28, 2015 at 10:15 am #260649
Hi there, I was wondering if it is at all possible to create a button that will open a modal or lightbox type window with a gravity form in it? If so would someone please explain how that might be achieved?
Thanks
KenApril 28, 2015 at 12:51 pm #260767Hi There,
Thanks for writing in.
You can try adding this following code to the page / post content, don’t forget to switch your Content Editor to Text Mode:<div id="my-content"> [gravityform id=1 title=false description=false ajax=true tabindex=49] </div> <a href="#my-content" class="lightbox-selector x-btn" data-type="inline">Click Me</a> [lightbox selector=".lightbox-selector"]
Hope it helps.
April 28, 2015 at 12:59 pm #260777That looks very promising!
I added the code but it renders the form on the page and it shows it again when I click the button in the modal window. Do I just add css to hide the #my-content so it wont show initially?
April 28, 2015 at 4:22 pm #260933Hi there,
To assist you with this issue, we’ll first need you to provide us with your URL. This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.
Thanks!
April 28, 2015 at 5:22 pm #260962I just added #my-content {display:none;} to the custom CSS. Now it doesn’t show the form in the container on initial page load and works in the modal window when I click the button.
Thanks for your direction on this.
April 28, 2015 at 8:33 pm #261060Glad you were able to figure it out 🙂
July 27, 2015 at 6:14 pm #342294Hey there. I followed along with your instructions and everything works correctly… Except that I have two buttons on my page and for reasons unknown to me it looks like 2 forms are getting loaded on the page…
You can see what I mean here:
https://www.zomalo.com/invite/Thank you!
July 28, 2015 at 12:09 am #342483Hello @nepatriot
Thanks for updating! It seems you are using same ID (#my-content-1) for both of your contents. You should use different IDs for those.
Hope this helps.
Cheers!
July 28, 2015 at 3:14 pm #343343No problem! Thanks for the response.
So I changed the div IDs to make them unique: #my-content-1/#my-content-2. However I am still seeing the same issue…
Here is the code I am using – not sure why it’s not working…
<div id="my-content-2"> [gravityform id=11 title=false description=false ajax=true tabindex=49]</div> <a href="#my-content-2" class="lightbox-selector x-btn" data-type="inline">Get Started</a> [lightbox selector=".lightbox-selector"]
<div id="my-content-1"> [gravityform id=11 title=false description=false ajax=true]</div> <a href="#my-content-1" class="lightbox-selector x-btn" data-type="inline">Get Started</a> [lightbox selector=".lightbox-selector"]
July 28, 2015 at 6:27 pm #343498Hi There,
Sorry but I couldn’t see any gravity form on the URL provided, please clarify. Also make the
[lightbox selector=".lightbox-selector"]
shortcode unique for each contact form so they would not show on the same lightbox.Thanks!
July 28, 2015 at 10:32 pm #343636Thanks for the response.
To see the forms (loading the same form on each click event) you have to click the ‘Get Started’ button.
It looks like using the unique selector prevents the issue with the forms loading twice.
However, the lightboxes are different in size… any idea why this is happening? I tried setting the div width to a fixed value but no cigar. How can I get the two lightboxes be the same size?
July 29, 2015 at 1:10 am #343729Hi There,
To make the form same size, You can add this under Custom > CSS in the Customizer.
.ilightbox-holder div.ilightbox-container { width: 100% !important; }
Hope this helps.
Cheers!
July 29, 2015 at 3:04 pm #344515Thanks. That works flawlessly!
July 29, 2015 at 6:54 pm #344668You’re most welcome!
December 9, 2015 at 10:59 pm #700428How can I do this using cornerstone?
-
AuthorPosts