I would usually achieve this functionality by assigning a <div> class that wraps all the images that should be hidden. Then, each time you click, hide the corresponding div and show what you need:
$(document).ready(function(){ $('#navigation a').click(function (selected) { var getName = $(this).attr("id"); var projectImages = $(this).attr("name"); $('div.special_images').hide(); $("#" + projectImages ).show("normal"); }); });
In addition, you do not need to wrap the projectImages project code:
$(function() { ... });
This is the shortcut for the code you have above:
$(document).ready(function() {...});
which already completes all the code.
source share