-
AuthorPosts
-
March 14, 2020 at 4:59 am #1193044
On my page, I have a table and on the last column, I have custom buttons labelled (View Floor Plan).
I would like a lightbox to popup once the button is clicked on. The lightbox will include an image and a text link below. How do I achieve that?
Please note my button code is the following:
<div class=”btnFloorPlan”>VIEW FLOOR PLAN</div>
My site
March 14, 2020 at 11:13 pm #1193139Hey navindesigns,
Thanks for the login, I see that you have 5 buttons, so I assume you will need 5 different popups.
First we will add the jQuery for the popup in your functions.phpfunction popup_inline() { ?> <script type="text/javascript"> jQuery(window).load(function(){ jQuery('.open-popup-link').magnificPopup({ type:'inline', midClick: true }); }); </script> <?php } add_action('wp_head', 'popup_inline');
Then we will add this css to your Quick CSS:
.white-popup { position: relative; background: #FFF; padding: 20px; width: auto; max-width: 500px; margin: 20px auto; }
Then we will add five popups to a code block element on the page, you can edit the part
PLACE CONTENT ONE HERE
by adding text and image shortcodes or html code:<div id="one-popup" class="white-popup mfp-hide"> <p>PLACE CONTENT ONE HERE</p> </div> <div id="two-popup" class="white-popup mfp-hide"> <p>PLACE CONTENT TWO HERE</p> </div> <div id="three-popup" class="white-popup mfp-hide"> <p>PLACE CONTENT THREE HERE</p> </div> <div id="four-popup" class="white-popup mfp-hide"> <p>PLACE CONTENT FOUR HERE</p> </div> <div id="five-popup" class="white-popup mfp-hide"> <p>PLACE CONTENT FIVE HERE</p> </div>
then for your buttons I added the link like this:
<a class="open-popup-link" href="#two-popup"><div class="btnFloorPlanMobile">VIEW FLOOR PLAN</div></a>
notice each link has a different anchor to open a different popup.
Now there is a little white space where the hidden code block is on the page, so I added this to the code block to hide the white space:<style> #after_section_1 { display: none !important; } </style>
Please clear your browser cache and check the buttons and popups.
Best regards,
MikeMarch 15, 2020 at 2:15 am #1193155WOW. This is great.
Just one small change, I wanted the popup to be a bit larger/wider. I changed the css max-width to 1000px but it didnt change the size. Can you help with that?
I really appreciate this
March 15, 2020 at 9:43 am #1193186.mfp-inline-holder .mfp-content, .mfp-ajax-holder .mfp-content { width:1000px; }
March 15, 2020 at 10:39 am #1193188Hi,
@Guenni007 Thanks for sharing, @navindesigns please try adding this css.Best regards,
MikeApril 10, 2020 at 5:34 pm #1202697Thanks Mike,
Is it possible to add a second button to the popup? Client wants the option to “email” the floor plans to someone directly from the popup.
Thanks
April 11, 2020 at 4:18 pm #1202945Hi,
Inside the popup you can add any content or shortcodes, for example code this would be another button:[av_button label='Large Button' icon_select='yes' icon='ue82b' font='entypo-fontello' size='small' position='center' label_display='' title_attr='' color='theme-color' custom_bg='#444444' custom_font='#ffffff' link='manually,http://' link_target='' id='' custom_class='' av_uid='' admin_preview_bg='']
Best regards,
MikeApril 18, 2020 at 5:01 pm #1205012Works. Amazing help. You save me a ton here
Much appreciated. Hope you are staying safe!
April 18, 2020 at 5:05 pm #1205026Hi,
I’m glad this was resolved. If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon -
AuthorPosts
- The topic ‘Open image in lightbox with custom button’ is closed to new replies.