Created
July 8, 2014 21:15
-
-
Save wilhelser/c7346c7b44cddb2cf3db to your computer and use it in GitHub Desktop.
Menu Image jQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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