I currently have two dropdown menus called NEW and SHOP.
When I hover over the New Menu 1, it should display the corresponding image. Similarly, when hovering over New Menu 2, the related image should be shown in a div with the ".menu-viewer" class.
While this functionality is working, it is also changing the image of the shop menu, which is not intended.
Furthermore, the default image for the shop menu is not displayed automatically.
Please take a look at the Fiddle I've set up and let me know what mistake I might be making.
If my explanation is unclear or confusing, please don't hesitate to ask for clarification.
https://jsfiddle.net/cancerian73/qwtono6c/
var $img = $('.menu-viewer img'),
dsrc = $img.attr('src');
$('.menu-list ul li a').hover(function() {
var $this = $(this).addClass('hover');
$img.attr('src', $this.data('image'));
}, function() {
$(this).removeClass('hover');
$img.attr('src', dsrc);
});
$('.menu-list ul li').bind('mouseenter focusin',function() {
$($(this).attr('href')).show();
}).bind('mouseleave focusout',function() {
$($(this).attr('href')).hide();
});