mdui has a built-in lightweight JavaScript utility library with a jQuery-like API and chaining style, but it is only one-sixth the size of jQuery.
Data Type Checking
<button class="mdui-fab mdui-ripple">
<i class="mdui-icon material-icons">add</i>
</button>
<button class="mdui-fab mdui-color-theme-accent mdui-ripple">
<i class="mdui-icon material-icons">add</i></button
>Object Access
<button class="mdui-fab mdui-fab-mini mdui-ripple">
<i class="mdui-icon material-icons">add</i>
</button>
<button
class="mdui-fab mdui-fab-mini mdui-color-theme-accent mdui-ripple"
>
<i class="mdui-icon material-icons">add</i></button
><button
class="mdui-fab mdui-color-theme-accent mdui-ripple"
id="fab-animation"
>
<i class="mdui-icon material-icons">add</i>
</button>
<button class="mdui-btn" id="fab-animation-show">show</button>
<button class="mdui-btn" id="fab-animation-hide">hide</button>
<script>
var fab = document.getElementById('fab-animation');
document
.getElementById('fab-animation-show')
.addEventListener('click', function () {
fab.classList.remove('mdui-fab-hide');
});
document
.getElementById('fab-animation-hide')
.addEventListener('click', function () {
fab.classList.add('mdui-fab-hide');
});
</script>
Node Attributes
<button class="mdui-fab mdui-fab-fixed mdui-ripple">
<i class="mdui-icon material-icons">add</i>
</button>Run<div class="mdui-fab-wrapper" id="exampleFab">
<button class="mdui-fab mdui-ripple mdui-color-theme-accent">
<!-- Styles -->
<i class="mdui-icon material-icons">add</i>
<!-- Finding Nodes -->
<i class="mdui-icon mdui-fab-opened material-icons">add</i>
</button>
<div class="mdui-fab-dial">
<button class="mdui-fab mdui-fab-mini mdui-ripple mdui-color-pink">
<i class="mdui-icon material-icons">backup</i>
</button>
<button class="mdui-fab mdui-fab-mini mdui-ripple mdui-color-red">
<i class="mdui-icon material-icons">bookmark</i>
</button>
<button class="mdui-fab mdui-fab-mini mdui-ripple mdui-color-orange">
<i class="mdui-icon material-icons">access_alarms</i>
</button>
<button class="mdui-fab mdui-fab-mini mdui-ripple mdui-color-blue">
<i class="mdui-icon material-icons">touch_app</i>
</button>
</div>
</div>Node Manipulation
<div class="mdui-fab-wrapper" mdui-fab="{trigger: 'hover'}">
......
</div>Forms
// Events
// More Common Methods
var inst = new mdui.Fab(selector, options);| Param Name | Type | Default | Description |
|---|---|---|---|
trigger | string | hover | This method has multiple usages:
|
| Method Name | Description |
|---|---|
open() | An HTML string can be passed to return a JQ object containing the DOM created based on the HTML. |
close() | A function can be passed, which will be called after the DOM is fully loaded. |
toggle() | If only one object is passed, the properties in that object will be merged into the JQ object, which is equivalent to adding new functionality under the JQ namespace. |
show() | Then the custom method can be called like this |
hide() | If two or more objects are passed, properties from all objects are added to the first object, and the merged object is returned. |
getState() | In this case, both the first object and the return value are { key1: val1, key2: val2, key3: val3 } |
| Event Name | Description | Target | Params |
|---|---|---|---|
open.mdui.fab | Extend methods on the JQ prototype chain. | <div class="mdui-fab-wrapper"></div> | Then the extended method can be used like this |
opened.mdui.fab | Serialize an object or array and return a string suitable for URL parameters. | ||
close.mdui.fab | If the parameter is an array, it must be in the same format as the return format of <code>.serializeArray()</code>: | ||
closed.mdui.fab | Traverse an array or object. The return value is the first parameter, i.e., the array or object being traversed. |
| Class Name | Description |
|---|---|
.mdui-fab | The first parameter of the function is the index position of the array or the key of the object; the second parameter is the value at the corresponding position of the array or object. |
.mdui-fab-mini | The <code>this</code> in the callback function points to the value at the corresponding position of the array or object. If the callback function returns <code>false</code>, the traversal stops. |
.mdui-fab-hide | Traverse an array |
.mdui-fab-fixed | Result: |
.mdui-fab-wrapper | Traverse an object |
.mdui-fab-opened | Append elements of the second array to the first array and return the merged array. |
.mdui-fab-dial | Filter out duplicate elements in the array. |