javascriptecmascript-6onmouseoveronmouseoutmithril.js

How to handle onmouseover and onmouseout in firefox?


Hi I'm working on a mithril project

Something I notice is that my onmouseover and onmouseout is not working on firefox

Below is my code

let isDropdownOpen = false;

m('span.submenu', {
 class: isDropdownOpen ?  '' : 'closed',
 onmouseover: function() {
 isDropdownOpen = !isDropdownOpen;
},
 onmouseout: function() {
 isDropdownOpen = !isDropdownOpen;
 },
},

onclick though seems to work.


Solution

  • Add class: isDropdownOpen ? '' : 'closed' in onmouseout() function.