Gumby - trigger modal with a URL

299 Views Asked by At

I have a gumby modal defined in my home page. I would like to launch the modal using a specific URL. So I do redirect to /home#modal_trigger it would re direct to /home page and automatically launch the modal.

1

There are 1 best solutions below

0
ed1t On

I figured it out. Used the following code:

var hashId = window.location.hash;
hashId = hashId.match(/#[^?&\/]*/g);

if (hashId == "#modal_triger") {
  $('.modal#modal_trigger').addClass('active');
}