Debugging mode
HitboxJS provides a very handy debugging mode to help you see the collisions. It highlights the current collisions in the DOM.

You can enable the debugging mode by setting the debug
parameter to true when creating your watcher.
const hitboxWatcher = new Hitbox({
elements: '.my-elements',
debug: true
})
You can also use the setDebug()
method to enable or disable debugging mode at any time.
const hitboxWatcher = new Hitbox({
elements: '.my-elements'
})
hitboxWatcher.setDebug(true) // Debug mode is now enabled
hitboxWatcher.setDebug(false) // Debug mode is now disabled
Last updated
Was this helpful?