Skip to content

Instantly share code, notes, and snippets.

@wilhelser
Created July 8, 2014 21:15
Show Gist options
  • Save wilhelser/c7346c7b44cddb2cf3db to your computer and use it in GitHub Desktop.
Save wilhelser/c7346c7b44cddb2cf3db to your computer and use it in GitHub Desktop.
Menu Image jQuery
jQuery(document).ready(function($) {
items = $('#menu-main-menu-1 li');
$.each(items, function() {
parent = $(this);
target = $(parent).find('.sub-menu-item-image');
image = $(parent).find('img');
src = $(image).prop('src');
$(target).html("<img class='menu-image' src='" + src + "' alt='menu image'>");
$(image).hide();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment