Closing a modal if the user clicks anywhere

  • photoguy123
    Asked on June 25, 2019 at 3:27 AM

    I implemented your modal window which is great. But can you please tell me if it can be modified so that it closes by clicking anywhere on screen rather than clicking the X? Currently the X is positioned all the way at far right which people may not see. So possibly if the X can be just in the corner of the image that might be fine. But I think most people are used to being able to just click anywhere to close a modal. If someone has trouble closing the modal and getting back to the order form they might give up, so it should be easy to close without having to click the X.

    I would share a link here to my form, but perhaps if you can use a sample instead so we can keep this info public.

  • jherwin
    Replied on June 25, 2019 at 4:10 AM

    If you want to move or place the button to the left/right side, please inject the custom CSS Code:

    a.close {
        left: 10px!important;
    }

    Guide: How-to-Inject-Custom-CSS-Codes

    You can modify the code and place it anywhere you like.

    As for closing the modal if they click anywhere, unfortunately, that is not possible with the form builder. You need to add script code for that and our form does not accept script codes for security reasons. You can use your form full source code and embed it on your webpage if you really want to add a script to your form.

    Sample script/code: https://www.w3schools.com/w3css/tryit.asp?filename=tryw3css_modal_close

    Guide: How-to-get-the-Full-Source-Code-of-your-Form