Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: Modal show on delay

demzl25 priority asked 2 years ago


Hi,

How to set Modal to have 10s delay to show only one time not every 10s?

Here is my js code without delay:

const myPopupModal = document.getElementById("myModal");const modal = new mdb.Modal(myPopupModal); modal.show();

I have also try to add in Modal data-mdb-delay="10000" but is not working.

Thanks,

Damjan


Mateusz Lazaru staff answered 2 years ago


Hi,

I think the best way to achieve expected result is to use:

setTimeout(() => modal.show(), 10000)

instead of:

modal.show()

demzl25 priority commented 2 years ago

Great thanks,

Damjan


mukeshk free commented 2 years ago

This works fine for me -

setTimeout(function() { $('#myModal').modal('show'); }, 5000);



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 4.0.0
  • Device: Pc
  • Browser: Chrome 97.0.4692.99
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No