Modal: Prevent Closing on Click Outside

3 replies · opened Jul 19, 2017

GGraphics_OneJul 19, 2017

Hi,

Is it possible to prevent a modal from closing, when a visitor clicks outside of the modal itself?

Thanks in advance!

SSemicolon WebSTAFFJul 22, 2017

Hello,

This is Definitely Possible! Can you please let us know which Modal you are using so that we can provide you with the accurate codes for this. Thanks for your Patience.

Meanwhile, do let us know if we can help you with anything else or if you find any further issues with Canvas.

GGraphics_OneJul 26, 2017

The Modal in question is modal-on-load, either simple or subscription.

Thanks in advance.

SSemicolon WebSTAFFJul 28, 2017

Hello,

This is Definitely Possible!

Simply find the following code in the js/functions.js File inside the modal: function() Function Block:

$.magnificPopup.open({
	items: { src: elementTarget },
	type: 'inline',
	mainClass: 'mfp-no-margins mfp-fade',
	closeBtnInside: true,
	fixedContentPos: true,

and replace it with:

$.magnificPopup.open({
	items: { src: elementTarget },
	type: 'inline',
	mainClass: 'mfp-no-margins mfp-fade',
	closeBtnInside: true,
	fixedContentPos: true,
	closeOnBgClick: false,

This will definitely work fine. Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard