Modal on load, is possible to add a timer?

3 replies · opened Apr 4, 2017

JjuanleApr 4, 2017

Hello, thanks for your great work.

Modal on load is great. However, could I trigger the action few seconds after instead of right away? use case... user reaches a landing page... instead of bother him directly... I wait 10 seconds... and later I will show the pop up message. That would be quite useful.

Thanks
Juan

JjuanleApr 4, 2017

I have tried with

setTimeout(function() {
$('#myModal1').modal();
}, 2000);

But it does not work. The screen goes black, the but the modal does not appear.

I have tried also with

$(window).load(function(){
setTimeout(function(){
$('#myModal1').modal('show');
}, 2000);
});

But the problem is the same

JjuanleApr 4, 2017

I managed to solve the problem reading documentation from bootstrap http://getbootstrap.com/javascript/#modals

Class should be changed from class="modal1 mfp-hide" to class="modal"

Plus close button should be <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>

JjuanleApr 4, 2017

PS. and javascript setTimeout(function() {
$('#myModal1').modal('show');
}, 10000);

You can mark topic as solved

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