material design checkbox - Download Material Design Style Checkboxes In jQuery - matd_checkbox

Download Material Design Style Checkboxes In jQuery – matd_checkbox

Posted on

This time I will share jQuery Plugin and tutorial about Material Design Style Checkboxes In jQuery – matd_checkbox, hope it will help you in programming stack.

material design checkbox - Download Material Design Style Checkboxes In jQuery - matd_checkbox
File Size: 14.6 KB
Views Total: 587
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

The matd_checkbox jQuery plugin lets you create customizable, Material Design style checkboxes with support for indeterminate state.

How to use it:

1. Add jQuery library and the jQuery matd_checkbox plugin’s files to the page.

1 <link rel="stylesheet" href="matd_checkbox.css">
2 <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
3 <script src="matd_checkbox.min.js"></script>

2. Attach the function matd_checkbox() to the regular checkbox input and done.

1 <input id="example" type="checkbox">
1 $('#example').matd_checkbox();

3. Enable the indeterminate state. Default: false.

1 $('#example').matd_checkbox({
2   partial: true
3 });

4. Check the checkbox input on init. Default: false.

1 $('#example').matd_checkbox({
2   checked: true
3 });

5. Customize the colors of the Material Design checkbox.

1 $('#example').matd_checkbox({
2   clicked_color: '',
3   outline_color: '',
4   style_color: '',
5   style_out_color: ''
6 });

6. Customize the template of the Material Design checkbox.

1 $('#example').matd_checkbox({
2   templateString: '<span class="matd_cb_container"><span class="flex-base matd_cb_inner" data-checked="${checked}" data-indeterminate="${partial}"><svg class="matd_cb_svg" focusable="false" viewBox="0 0 24 24" aria-hidden="true" role="presentation"><path class="matd_cb_off" style="${style_out_color}" d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"></path><path class="matd_cb_on" style="${style_color}" d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"></path><path class="matd_cb_part" style="${style_color}" d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"></path></svg><input id="mtdcb_${id}" ${placeholder} class="matd_cb_input" type="checkbox" value="chk_val"></span></span>',
3 });

7. Check/uncheck the checkbox programmatically.

1 $('#example').matd_checkbox('go_check', true);
2 $('#example').matd_checkbox('go_check', false);

This awesome jQuery plugin is developed by CBairdAsh. For more Advanced Usages, please check the demo page or visit the official website.

source : jquery.net