Contact as a Menu Minipanel

My Contact page now drops down from the menu. This means you can Contact me without leaving the page you're on. In the past you'd've been taken to a traditional Contact page. Less clicks is better. To do this I installed the following modules:-

I then created a minipanel using my existing Contact page and enabled the minipnael for the Contact menu item. Follow the documentation for the modules on how to do this.

To make the menu mobile friendly I disabled the menu link. This means a user can tap on the link and have the dropdown appear instead of being taken to the Contact page. Mouse users just hover over the item  for the same effect. To do this required finding the CSS selector for the menu item (.menu-item-1266 in my case), and a little javascript to trick the browser:-

(function($){
Drupal.behaviors.theme_theme-name = {
attach: function () {
$('.menu-item-1266 ' +
'a:not(.theme-name-processed)').attr('href', '#')
                                   .addClass('theme-name-processed');
}
};
})(jQuery);

Replace menu-item-1266 with the CSS selector for your menu item, and theme-name with the name of your theme and save this file into your /sites/all/themes/theme-name/js folder and into your <theme-name>.info file insert the line:-

scripts[] = js/nolink.js

Add new comment