Automatic modal when starting home page

Hello @Pealco.

Very good your new contributions to my initial question.

If you can tell me the code you have added to get the two new options, I would be very grateful.

You are a good partner of the Community of Blocs.

With best regards.

This is to be underlined @Pealco is a great enrichment to this comuity and I rely apprechiate his errfort and support finding solutions - SUPER :+1:

Good morning @Pealco! We really appreciate having the opportunity to share knowledge, because it enriches the experience of all those who want to continue learning and improving day by day. I wanted to ask you for personal help, would it be possible for you to share the .bloc files in order to study and better understand the structure of the actions?

A million thanks in advance. :wink:

Dreamsur.-

Hello @Wam @pixelwork and @Dreamsur Iā€™m working in a platform that shares all the help.
Tonight (Portugal Time) I will share the platform. And then you will have everything, code, bex, etcā€¦ just spare a moment pleaseā€¦

Hello @Pealco.

As always, thanks for help and for your time.

I will wait without problems the time you need to prepare the complete platform with the code, BEX, etc ā€¦

Your help is very well received and appreciated by the entire Community of Blocs.

With best regards.

It works great at www.mcvmfonds.com
Thanks for your support.

1 Like

Many Thanks! Brilliant especially for our stupid dsgvo popups that we need in Europe :wink:

Can the modal be started automatically after 10 seconds?

Iā€™m sure itā€™s possible. MailChimp has the option. Just donā€™t know how.

Casey

Hello @RME and @casey1823 I think I know how to do itā€¦ in the morning I send you the code, and add it to the help site. I let you know. As Iā€™m with iPad only now.

3 Likes

Hello, @casey1823 and @RME

There you go, I create two solutions, one with cookies and one without cookies, and both started after loading page with delay of 5000ms (5sec.)

https://blocs.webtekpc.pt

The answer is in the mini site to @Wam, named: " Automatic modal when starting home page" and the codes are in Option 5 and 6.

Hope it helpsā€¦

3 Likes

Great @Pealco Thanks so much!

@Pealco The solution is perfect. Now I have an other question. :slight_smile:
Can the model starts after scrolling a bloc?

That would be indeed fabulosā€¦

1 Like

Let me found a way, Iā€™m writing the codeā€¦

It works in my head at least. never used the modal but based on @Pealco code above this seems correct.

<script>
$(document).ready(function() {
     // hide modal on page load
     $('#modal-32886').modal('hide');

     // window scroll function
     $(window).scroll(function() {

         //offset the scroll trigger in pixels
         if ($(document).scrollTop() > 100) {
               $('#modal-32886').modal('show');
         }
         else {
               $('#modal-32886').modal('hide');
         }
     });
});
</script>

Changing the scroll top value give you the option to start the modal at a later point on the page. I have such limited time these days, sorry.

Hello @Whittfield is almost that code, but what happened with it is that you enter in a loop situation.

For that condition only happens once, there is the code:

<script>
jQuery(document).ready(function($){

    $triggered_times = 0;

    $(window).on('scroll', function() {
		var y_scroll_pos = window.pageYOffset;
       	var scroll_pos_test = 150;   // set to whatever you want
       	
      	if(y_scroll_pos > scroll_pos_test && $triggered_times == 0 ) {

			$('#modal-32886').modal('show');
				
			$triggered_times = 1;   // to make sure the above action triggers only once

            }
    });

})
</script> 

Hope it replys to your need @RME

hey @Pealco It doesnā€™t work. I appreciate your support. Thanks.

Hello @RME and did you create the modal with that specific name? Modal-32886?

Sure, i did change the name. In preview mode works fine but not after extracting.