Skip to content

Commit

Permalink
documentation and demo
Browse files Browse the repository at this point in the history
  • Loading branch information
kkarpieszuk committed Nov 15, 2023
1 parent 6785518 commit 7b5a3fc
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/wpforms-multiselect-checkboxes.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions docs/assets/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,21 @@ article h3 {
background-color: #f6f7f7;
}

.custom-opener-wrap {
vertical-align: middle;
margin-bottom: 10px;
}

.custom-opener {
background-color: #fff;
border: 1px solid #ccd0d4;
border-radius: 4px;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
padding: 8px 10px;
color: #2c3338;
cursor: pointer;
}


/**
* Footer
Expand Down
13 changes: 13 additions & 0 deletions docs/assets/js/initializers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
// Call the initialization function when the DOM is ready
function initializeDropdownCheckboxes() {
const dropdowns = document.querySelectorAll( '.dropdown' );
const dropDownWithCustomOpener = document.querySelector( '.dropdown-with-custom-opener' );
const customOpener = document.querySelector( '.custom-opener' );

dropdowns.forEach( ( dropdown ) => {
const multiSelectCheckbox = new WPFormsMultiSelectCheckbox( dropdown );
Expand All @@ -29,6 +31,17 @@ function initializeDropdownCheckboxes() {
multiSelectCheckbox.update( dropdown, valuesToSet );
}
} );

// Example of how to set a custom opener
if ( dropDownWithCustomOpener ) {
const multiSelectCheckbox = new WPFormsMultiSelectCheckbox(
dropDownWithCustomOpener,
{
customOpener,
}
);
multiSelectCheckbox.init();
}
}

document.addEventListener( 'DOMContentLoaded', initializeDropdownCheckboxes );
Loading

0 comments on commit 7b5a3fc

Please sign in to comment.