question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add a Materialize.init() function

See original GitHub issue

Turbolinks is ruby gem massively used by Ruby on Rails applications. It intercepts each get request, fetches the content and swaps is without doing the full page reload.

Since document ready is not triggered after the content is dynamically swapped, materialize js is not initialized.

Since turbolinks offer custom events, problem could be easily solved if there is a nice and simple way to dynamically initialize js modules. Something like Materialize.init(). It can then be internally called on document ready, but would further allow developers to manually initialize them whenever needed.

I’m sure that turbolinks are just one example and that there are many more cases where this issue arises.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
DanielRufcommented, Dec 12, 2017

The event listener should also fire for dynamically added elements.

1reaction
fegacommented, Apr 6, 2017

Added to the feature request board

Read more comments on GitHub >

github_iconTop Results From Across the Web

Auto Init - Materialize
Auto Init allows you to initialize all of the Materialize Components with a single function call. It is important to note that you...
Read more >
Initializing Materialize functions - javascript - Stack Overflow
I am having trouble initializing some Materialize-css ...
Read more >
Angularjs directives for Materialize CSS Framework
It includes a number of directives, which makes sure that the components in materialize.js, which are mainly initialized on document ready, are handled...
Read more >
Modals with Materialize - Michael Jan Schiumo - Medium
In our App.js file, we need to import 'M' from Materialize, which will allow us to use methods like AutoInit() for initializing Materialize...
Read more >
Materialize CSS Crash Course [Part 2] - JavaScript Widgets
In this second part of the Materialize crash course, we will look at the JavaScipt widgets included in the framework.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found