modal-on-load

8 replies · opened Aug 12, 2020

Ooskar321Aug 12, 2020

Hi friends,
something weird is happening. My modal-on-load was working fine, until today. It was only commented out until I need it again and nothing has been changed on the code. There's no error message or something else but it's not showing up.
https://www.tuttipasta-hannover.de

Please help
Thanks :)

SSemicolon WebSTAFFAug 13, 2020

Hello,

This issue is a result of Customized Codes. There are a lot of HTML Validation Errors on your Website: https://validator.w3.org/nu/?doc=https%3A%2F%2Fwww.tuttipasta-hannover.de%2F which could be causing this issue. Please consider fixing these first and this could automatically fix your issue. If the issue persists, please let us know and we will check this further.

Hope this Helps!

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

Ooskar321Aug 13, 2020

Hi there,
I could find the problem which caused the modal-on-load not working.
you're right, I had some errors in validator but they didn't caused any error in site execution.

I had removed the plugins.js from my site, under your advice to another user here.
"You can simply remove the js/plugins.min.js File. Then, the AJAX JS Loading will be automatically activated and will load only the JS Files needed on the Page."

When I follow your advice, the modal-on-load instruction isn't working.

And I've found a additional error, which isn't important but still there. I have the error message that bootstrap.css.map file is missing. As I remember, you was going to remove that :)

Regards
Oskar

SSemicolon WebSTAFFAug 13, 2020

Hello,

Thanks for reporting these. However, we noticed that you were using an Older Version of Canvas. We have made many improvements in the way Plugins are executed in the Latest Versions, so it is highly recommended to keep your Websites updated with the Latest Version of Canvas to avoid any unexpected issues.

Meanwhile, for the bootstrap.css.map Error, the Bootstrap CSS is directly used from the Official Website: https://getbootstrap.com/ in its unmodified form, so you can use it directly from the CDN as well and everything will work in the same way. So all the Core Plugins is kept as it is without removing the default codes including the bootstrap.css.map Reference.

Hope this Helps!

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

Ooskar321Aug 14, 2020

Hi,
I used the 602 Version. How can I update to the newest, without coding too much?
Is it enough to upgrade all css and js files?
As my site is a one-pager with some pictures and without complicated functions, it should work. I hope at least :)

Many regards and thanks that you're always for us here :)
Oskar

Ooskar321Aug 14, 2020

Two more questions please.

  1. I would like to close the modal with a click inside the popup
    and
  2. I want the modal show only once a day with cookie enabled.

For the first problem I was searching in functions.js for the $lightboxInlineEl.magnificPopup({ block but it isn't there anymore.

For the second problem, I'm lost.

Any help would be fine :D

Best regards and thanks in advance :)

SSemicolon WebSTAFFAug 15, 2020

Hello,

  1. If you upgrade all the CSS/JS Files, you will lose your Customization. Make sure to keep your Customizations different: http://docs.semicolonweb.com/docs/getting-started/theme-customization/ . Please consider following the Changelogs: http://docs.semicolonweb.com/docs-group/changelog/ and make the changes according to the list of Code Changes mentioned there.

  2. You will need to update the js/plugins.lightbox.js File. Find the following block of code:


$.magnificPopup.open({
	items: { src: elTarget },
	type: 'inline',
	mainClass: 'mfp-no-margins mfp-fade',
	closeBtnInside: false,
	fixedContentPos: true,
	removalDelay: 500,
	callbacks: {
		open: function(){
			if( elAnimateIn != '' ) {
				$(elTarget).addClass( elAnimateIn + ' animated' );
			}
		},
		beforeClose: function(){
			if( elAnimateOut != '' ) {
				$(elTarget).removeClass( elAnimateIn ).addClass( elAnimateOut );
			}
		},
		afterClose: function() {
			if( elAnimateIn != '' || elAnimateOut != '' ) {
				$(elTarget).removeClass( elAnimateIn + ' ' + elAnimateOut + ' animated' );
			}
			if( elCookies == 'true' ) {
				Cookies.set( elTargetValue, '0' );
			}
		}
	}
}, 0);

and replace it with:


$.magnificPopup.open({
	items: { src: elTarget },
	type: 'inline',
	mainClass: 'mfp-no-margins mfp-fade',
	closeBtnInside: false,
	closeOnContentClick: true,
	fixedContentPos: true,
	removalDelay: 500,
	callbacks: {
		open: function(){
			if( elAnimateIn != '' ) {
				$(elTarget).addClass( elAnimateIn + ' animated' );
			}
		},
		beforeClose: function(){
			if( elAnimateOut != '' ) {
				$(elTarget).removeClass( elAnimateIn ).addClass( elAnimateOut );
			}
		},
		afterClose: function() {
			if( elAnimateIn != '' || elAnimateOut != '' ) {
				$(elTarget).removeClass( elAnimateIn + ' ' + elAnimateOut + ' animated' );
			}
			if( elCookies == 'true' ) {
				Cookies.set( elTargetValue, '0' );
			}
		}
	}
}, 0);
  1. For the Cookies, first, you will need to add the data-cookie="true" Attribute to the Modal on Load Element in the HTML File. Documentation: http://docs.semicolonweb.com/docs/shortcodes/modal-on-load/#docs-snippet-enable-cookies-on-modal .

Now, find the following code in the JS File:


Cookies.set( elTargetValue, '0' );

and replace it with:


Cookies.set( elTargetValue, '0', { expires: 1 });

This will enable Cookies for that Modal for a Day. Hope this Helps!

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

Ooskar321Aug 15, 2020

You're the best ? Everything works like a charm.

I customized only the index.html file and put all custom css codes into the custom.css file. I just updated all files to 604 and kept my two custom files. Works perfect and faster than before in lighthouse index.

Thank you very much

SSemicolon WebSTAFFAug 15, 2020

Hello,

Very Happy to Help! :)

Glad that the issues were resolved and everything works great. We will keep working on trying to improve the performance with every future update.

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

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