<input type='hidden' id='open-modal' data-toggle='#modal' data-target='#modal-id' />
let isOpen = false;
$('#item-to-open-modal').on('mouseenter', () => {
if (!isOpen) {
document.getElementById('open-modal').click()
isOpen = true;
}
})
$('#item-to-open-modal').on('mouseleave', () => {
if (isOpen) {
document.getElementById('close-modal').click()
isOpen = false
}
})