Modal Foundation via URL

Asked

Viewed 83 times

0

I need to open a modal zurb-foundation via URL. For example http://sistema.com.br/agenda/#modal99

Follows the code:

Html:

<a href="#modal99">Show Modal</a>

Javascript:

 $('#modal99').foundation('open');

The code does not open the modal.

Note: I cannot use <a data-open="modal99">Show Modal</a>. And neither <a id="modal99">Show Modal</a>. It has to be via href.

  • In Javascript tries $('#modal99').foundation('reveal', 'open');

  • Doesn’t open @Lucascosta yet

  • I made a fiddle by taking the event click on the link and opening a modal and it worked.. is that what you need? https://jsfiddle.net/lbclucascosta/sqyd9xbc/1/

  • @Lucascosta I can’t use id="modal99" as I mentioned in the observation. It has to be via href.

  • There is no way to point a href and change the shape of the modal. I don’t know why you need to do it this way, but one solution is to use the selector href in Jqquery and open the modal, more or less like this: $("[href='#modal99']"): https://jsfiddle.net/lbclucascosta/sqyd9xbc/2/

  • Your example works, but you wanted something like this. var url = Document.URL.split('#'); var modalUrl = (url[url.length - 1]); $('#modal' + modalUrl). Foundation('open'');

  • The most effective solution is to use the fullcalendar array. Which would be: eventClick: Function (Event) { var key = Event. _id; $('#modal' + key). Foundation('open'); }

Show 3 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.