Auto Init
Materialize is a modern responsive CSS framework based on Material Design by Google.
Auto Init allows you to initialize all of the Materialize Components with a single function call.
Initialization
M.AutoInit();
Or with options to configure each components:
M.AutoInit(document.body, {
Dropdown: {
// pass options for Dropdown here
},
FloatingActionButtonOptions: {
// pass options for FloatingActionButtonOptions here
},
// Component: { ... }
});
Options
Name | Type | Default | Description |
---|---|---|---|
context | Element | document.body | DOM Element to search within for components. |
options | Object |
|
Options for each component (see components respective documentation for more information). |
Ignoring Elements
If you want
M.AutoInit()
to ignore a certain element, you can add the class .no-autoinit
to the
element and it will not be initialized by autoinit.