diff --git a/assets/controllers/materialize/dropdown_controller.js b/assets/controllers/materialize/dropdown_controller.js new file mode 100644 index 000000000..12a209d16 --- /dev/null +++ b/assets/controllers/materialize/dropdown_controller.js @@ -0,0 +1,16 @@ +import { Controller } from '@hotwired/stimulus'; +import M from '@materializecss/materialize'; + +export default class extends Controller { + connect() { + this.instance = M.Dropdown.init(this.element, { + hover: false, + coverTrigger: false, + constrainWidth: false, + }); + } + + disconnect() { + this.instance.destroy(); + } +} diff --git a/assets/index.js b/assets/index.js index 7d53241c3..e4c9336b3 100755 --- a/assets/index.js +++ b/assets/index.js @@ -274,13 +274,6 @@ const articleScroll = () => { $(document).ready(() => { $('select').formSelect(); - $('.dropdown-trigger').dropdown({ hover: false }); - $('.dropdown-trigger[data-covertrigger="false"][data-constrainwidth="false"]').dropdown({ - hover: false, - coverTrigger: false, - constrainWidth: false, - }); - $('.fixed-action-btn').floatingActionButton(); stickyNav(); diff --git a/templates/layout.html.twig b/templates/layout.html.twig index 172dab47a..9ff3b21ab 100644 --- a/templates/layout.html.twig +++ b/templates/layout.html.twig @@ -101,7 +101,7 @@ {% block nav_panel_extra_actions '' %}