Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #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

    #1193139

    Hey 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.php

    function 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,
    Mike

    #1193155

    WOW. 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

    #1193186
    .mfp-inline-holder .mfp-content,
    .mfp-ajax-holder .mfp-content {
     width:1000px;
    }
    #1193188

    Hi,

    @Guenni007
    Thanks for sharing, @navindesigns please try adding this css.

    Best regards,
    Mike

    #1202697

    Thanks 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

    #1202945

    Hi,
    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,
    Mike

    #1205012

    Works. Amazing help. You save me a ton here

    Much appreciated. Hope you are staying safe!

    #1205026

    Hi,

    I’m glad this was resolved. If you need additional help, please let us know here in the forums.

    Best regards,
    Jordan Shannon

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Open image in lightbox with custom button’ is closed to new replies.