When opening a modal via

<a class="use-ajax" data-dialog-type="modal" href="/search">Search</a>

Drupal does fire contexts via JS.
These context do not contain any dialog/modal specific code.

How to react on a modal opening and how to identify the modal?
I want to add an class to the modal for styling purposes depending on its content.

Perfect would be something like

<a class="use-ajax" data-dialog-type="modal" data-dialog-class="modal-class-for-search-view" href="/search">Search</a>

Also can I somehow open a modal via JS only?
In this moment I can just open static predefined modals by using the html code:

<a class="use-ajax" data-dialog-type="modal" href="/search">Search</a>

Thanks

Comments

mogio_hh created an issue. See original summary.

mogio_hh’s picture

Title: BootstrapDialog cannot load Ajax View » BootstrapDialog - Event when opening
Issue summary: View changes
mogio_hh’s picture

Category: Bug report » Support request
Priority: Major » Normal
mogio_hh’s picture

Issue summary: View changes
markhalliwell’s picture

Status: Active » Closed (duplicate)
Related issues: +#2831237: Bootstrap modal does not work well with jQuery UI dialog