Created
March 1, 2021 10:29
-
-
Save dgrammatiko/7506ddbb87abcd72dcba3b55de40b630 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright Dimitris Grammatikogiannis | |
* Lisence MIT | |
* | |
*/ | |
const toolbarActionButton = document.querySelector('#toolbar-status-group'); | |
const dropdown = toolbarActionButton.querySelector('.dropdown-menu'); | |
const dropdownButton = toolbarActionButton.querySelector('.dropdown-toggle'); | |
const onOver = (event) => { | |
console.log(event) | |
if (!event.target.closest('joomla-toolbar-button')) { | |
dropdownButton.click(); | |
document.removeEventListener('mouseover', onOver); | |
} | |
} | |
if(!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){ | |
toolbarActionButton.addEventListener('mouseenter', (ev) => { | |
dropdownButton.click(); | |
document.addEventListener('mouseover', onOver); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment