<div id="cf2" class="shadow">
  <img class="bottom" src="https://d152j5tfobgaot.cloudfront.net/wp-content/uploads/2015/07/blooging.jpg" />
  <img class="top" src="https://d152j5tfobgaot.cloudfront.net/wp-content/uploads/2015/08/blog1.jpg" />
</div>
<p id="cf_onclick">Click me to toggle</p>
#cf2 {
  position:relative;
  height:281px;
  width:450px;
  margin:0 auto;
}
#cf2 img {
  position:absolute;
  left:0;
  -webkit-transition: opacity 1s ease-in-out;
  -moz-transition: opacity 1s ease-in-out;
  -o-transition: opacity 1s ease-in-out;
  transition: opacity 1s ease-in-out;
}

#cf2 img.transparent {
opacity:0;
}
#cf_onclick {
cursor:pointer;
}
<script>
$(document).ready(function() {
  $("#cf_onclick").click(function() {
  $("#cf2 img.top").toggleClass("transparent");
});
});
</script>
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.