tombroucke/otomaties-bootstrap-popup

此包的最新版本(2.5.1)没有可用的许可信息。

安装数: 1,109

依赖项: 0

建议者: 0

安全性: 0

星标: 0

关注者: 1

分支: 0

开放问题: 7

类型:wordpress-plugin


README

从主题或其它插件加载 Bootstrap JS

如果你在主题或另一个插件中加载了 bootstrap JS,则不需要再次加载。重复加载会导致加载时间变慢,并可能引起冲突。

确保 otomaties-bootstrap-popup 首先加载

$dependencies = wp_script_is('otomaties-bootstrap-popup', 'enqueued') ? ['otomaties-bootstrap-popup'] : [];
bundle('app')->enqueueCss()->enqueueJs(true, $dependencies);

不加载 bootstrap 加载javascript

add_filter('otomaties_bootstrap_popup_load_bootstrap', '__return_false');

通过自定义 BootstrapLoaded 事件传递 modal 组件

import { Modal } from 'bootstrap';

const bootstrapComponents = {
    modal: Modal,
}

const bootstrapLoadedEvent = new CustomEvent('BootstrapLoaded', {detail: {components : bootstrapComponents}});
window.dispatchEvent(bootstrapLoadedEvent);

过滤器

使用 BS 4.x 而不是 5.x

add_filter('otomaties_bootstrap_popup_bootstrap_version', function() {
    return '4.x';
});

过滤可用的 bootstrap 主题

otomaties_bootstrap_popup_button_themes

居中弹出窗口

add_filter('otomaties_bootstrap_popup_modal_dialog_classes', function ($classes) {
    $classes .= ' modal-dialog-centered';
    return $classes;
});