Y
Y
Yuri Avanesov2016-12-14 14:26:02
HTML
Yuri Avanesov, 2016-12-14 14:26:02

How to call modal in Semantic UI?

Hello!
Guys, tell me, who knows how to call modal windows in the semantic ui framework?
There are specific instructions: semantic-ui.com/modules/modal.html#modal
call script, stml codes of the windows themselves - everything is exposed. But here's how to register a link, when you click on which this window will be called?
and how to be provided that it is necessary to set some pop-up windows to different links?
thank!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Guryev, 2018-07-03
@Danakishi

If we talk about several different windows, then you can do it as follows. In the loop, form all windows with different id, and in javascript already call them.
HTML:

<?php foreach ($items as $item): ?>
<button class="ui icon button show-modal" data-modal="#item-modal-<?= $item['id'] ?>">
  <i class="pencil icon"></i>
</button>

<div class="ui modal" id="item-modal-<?= $item['id'] ?>">
...
</div>
<?php endforeach; ?>

Javascript:
$('.show-modal').click(function (e) {
  e.preventDefault();

  var modal_id = $(this).attr('data-modal');

  $(modal_id).modal('show');
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question