Hiya,
Not going to lie, it was very difficult! But will do my best to explain.
- I used the model element for the popup. I created it as a component to make editing easier in the future.
- The buttons to trigger the modal need to be on the page for hover to work, but I just hid them by making it a very small pixel tucked away in the corner.
- For each modal popup, under ‘customise’, add a name to the ‘toggle hash’ box.
- I then added the ‘toggle hash’ names to the menu item that I wanted to trigger the hover.
- So now it was a case of having my new menu trigger the custom modal popup on click.
- Then I used this jQuery code to tell the custom menu items to trigger on hover rather than click:
<!-- jQuery to show/hide submenu on hover -->
<script>
$(document).ready(function(){
$('.menu-item').hover(
function() {
// Mouse enters the menu item
var submenuId = $(this).data('submenu');
$('#' + submenuId).show();
},
function() {
// Mouse leaves the menu item
var submenuId = $(this).data('submenu');
$('#' + submenuId).hide();
}
);
});
</script>
The jQuery was placed in a raw HTML element along with the HTML code for the menu.