New API hooks available after the 2.2 update
Hi! You're viewing an older article, in the Buttonizer 2.2. version we have implemented an easy API which can do a lot more than the code below!
This supports:
- Toggeling a group open/close
- Listing button groups
- Multiple event hooks to listen to
Click here to learn more about the JavaScript API
The code example below will still work, but we recommend you trying out our more extensible API 🙂
It will take a moment before Buttonizer is initialized. That isn't really handy when you want to let something happen with the Buttonizer buttons as your function will be executed before Buttonizer has buttons. That's why we've created this function. It's a free function and is available since Buttonizer 2.0.2.
After the menu/groups are build, the script will check if your page has the function buttonizerInitialized
available to call.
You can create this function by yourself by using a header/footer plugin to add this code to your website.
function buttonizerInitialized() {
console.log("Now, let something happen. Buttonizer is initialized");
}
Note: You don't need to call the function by yourself. Buttonizer will call your function buttonizerInitialized
after all buttons are created.