I'm trying to toggle an image and another div at the same time. I have it so that when you click on the image, the image switches and shows another div, but when you click again the image doesn't switch back. What am I missing to make it so that it switches back?
$("#swap").click(function() {
  $("#swap-nav").toggle("slow", function() {});
});
$('#swap-img').click(function() {
  this.src = 'i/icon.png';
}, function() {
  this.src = 'i/close.png';
});<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<li id="swap">
  <img id="swap-img" src="i/icon.png" data-swap="i/close.png">
</li>
<div id="swap-nav">
  <li>one</li>
  <li>two</li>
</div> 
     
    