在 Drupal 8 中,当您使用以下命令创建链接时使用引导主题class
and data-dialog-type
属性如下面的代码:
<a class="use-ajax" data-dialog-type="modal"
href="http://drupal.page/front">text
</a>
您将在以下位置打开页面内容#drupal-modal
具有这些 html 包装器的元素:
<div id="drupal-modal" class="modal fade in" tabindex="-1" role="dialog" style="display: block;">
<div class="modal-dialog" role="document">
<div class="modal-content">
该结构生成于:\themes\bootstrap\js\modal.js
我们如何才能看到link https://gist.github.com/Yog/a9b899ca0b31cc39f5929a75d5317dd1.
我如何修改它以便我可以将类名传递给#drupal-modal
来自链接的元素a.use-ajax
?类名文本可以是链接的属性值。
具体来说我想添加modal-lg
or modal-sm
类或一些自定义类。
data-dialog-options 允许您将任何选项传递给jQuery 对话框小部件 https://api.jqueryui.com/dialog/。其中一个选项是dialogClass
它允许您设置班级。
示例 HTML:
<a class="use-ajax"
data-dialog-type="modal"
data-dialog-options="{"width":800, "dialogClass": "product-information-incorrect"}"
href="#">Click me !</a>
无需自定义 js。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)