How to Maintain Zoom on Image while Adding a Hyperlink

I would like to add a hyperlink to the images (so that it will open a larger version of the image) within the gallery while maintaining the ‘zoom’ effect on the thumbnail. I attempted to add a hyperlink to the first image but the zoom was no longer running. I apologise if my explanation isn’t very good, I’m new to coding languages! Any help would be great!

Here is the link where I got the gallery code if it is any use to anyone! https://codepen.io/oknoblich/pen/ELfzd

< script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js" > < /script> <
  script type = "text/javascript" >


  (function() {

    var documentElem = $(document),
      nav = $('nav'),
      lastScrollTop = 0;

    documentElem.on('scroll', function() {
      var currentScrollTop = $(this).scrollTop();

      //scroll down
      if (currentScrollTop > lastScrollTop) nav.addClass('hidden');
      //scroll up
      else nav.removeClass('hidden');

      lastScrollTop = currentScrollTop;
    });
  })();

<
/script>
<!-- End of Javascript for Navigation Menu -->
<style type="text/css">@import url('https://fonts.googleapis.com/css?family=Open+Sans:300');
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.gallery {
  width: 640px;
  margin: 0 auto;
  padding: 5px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
}

.gallery>div {
  position: relative;
  float: left;
  padding: 5px;
}

.gallery>div>img {
  display: block;
  width: 200px;
  transition: .1s transform;
  transform: translateZ(0);
  /* hack */
}

.gallery>div:hover {
  z-index: 1;
}

.gallery>div:hover>img {
  transform: scale(1.1, 1.1);
  transition: .3s transform;
}

.cf:before,
.cf:after {
  display: table;
  content: "";
  line-height: 0;
}

.cf:after {
  clear: both;
}

h1 {
  margin: 40px 0;
  font-size: 30px;
  font-weight: 300;
  text-align: center;
}

</style>
<body>
  <!-- Start of Navigation Bar -->
  <nav>
    <ul>
      <li><a target="_blank" rel="nofollow" href="index.html">Home</a></li>
      <li><a target="_blank" rel="nofollow" href="about.html">About</a></li>
      <li id="current"><a target="_blank" rel="nofollow" href="gallery.html">Gallery</a></li>
      <li><a target="_blank" rel="nofollow" href="contact.html">Contact</a></li>
    </ul>
  </nav>
  <!-- End of Navigation Bar -->
  <br />
  <br />

  <h1> Gallery </h1>

  <!-- Stat of Gallery -->
  <div class="gallery cf">
    <!-- This is the image I tried to link but when I ran the code the zoom was no longer maintained. -->
    <div>
      <a target="_blank" rel="nofollow" href="Images/Optimized/FullImage_1.jpg"><img src="Images/Optimized/Thumbnail_1.jpg" width="200" height="300" alt="" /></a>
    </div>
    <div>
      <img src="Images/Optimized/Thumbnail_2.jpg" width="200" height="300" alt="" /> </div>
    <div>
      <img src="Images/Optimized/Thumbnail_3.jpg" width="200" height="300" alt="" /> </div>
    <div>
      <img src="Images/Optimized/Thumbnail_4.jpg" width="200" height="300" alt="" /> </div>
    <div>
      <img src="Images/Optimized/Thumbnail_5.jpg" width="200" height="300" alt="" /> </div>
    <div>
      <img src="Images/Optimized/Thumbnail_6.jpg" width="200" height="300" alt="" /> </div>
  </div>


here is the code this will work for sure and will display image in large size

https://jsfiddle.net/fsfrkru0/

html & CSS

@import url('https://fonts.googleapis.com/css?family=Open+Sans:300');
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font: 14px/1 'Open Sans', sans-serif;
  color: #555;
  background: #e5e5e5;
}

.gallery {
  width: 640px;
  margin: 0 auto;
  padding: 5px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
}

.gallery>div>a {
  position: relative;
  float: left;
  padding: 5px;
}

.gallery>div>a>img {
  display: block;
  width: 200px;
  transition: .1s transform;
  transform: translateZ(0);
  /* hack */
}

.gallery>div:hover>a {
  z-index: 1;
}

.gallery>div:hover>a>img {
  transform: scale(1.7, 1.7);
  transition: .3s transform;
}

.cf:before,
.cf:after {
  display: table;
  content: "";
  line-height: 0;
}

.cf:after {
  clear: both;
}

h1 {
  margin: 40px 0;
  font-size: 30px;
  font-weight: 300;
  text-align: center;
}
<h1>Simple CSS Image Gallery with Zoom</h1>

<div class="gallery cf">
  <div>
    <a target="_blank" rel="nofollow" href="http://abload.de/img/a6aawu.jpg" target="_blank"><img src="http://abload.de/img/a6aawu.jpg" styles="" /></a>
  </div>
  <div>
    <a target="_blank" rel="nofollow" href="http://abload.de/img/a6aawu.jpg" target="_blank"><img src="http://abload.de/img/a6aawu.jpg" styles="" /></a>
  </div>
  <div>
    <a target="_blank" rel="nofollow" href="http://abload.de/img/a6aawu.jpg" target="_blank"><img src="http://abload.de/img/a6aawu.jpg" styles="" /></a>
  </div>
  <div>
    <a target="_blank" rel="nofollow" href="http://abload.de/img/a6aawu.jpg" target="_blank"><img src="http://abload.de/img/a6aawu.jpg" styles="" /></a>
  </div>
  <div>
    <a target="_blank" rel="nofollow" href="http://abload.de/img/a6aawu.jpg" target="_blank"><img src="http://abload.de/img/a6aawu.jpg" styles="" /></a>
  </div>
  <div>
    <a target="_blank" rel="nofollow" href="http://abload.de/img/a6aawu.jpg" target="_blank"><img src="http://abload.de/img/a6aawu.jpg" styles="" /></a>
  </div>
</div>

hope this helps

The zoom is done using css and applied to the hover event if you apply the element a class with the same rules on click event it will keep the css properties.

I didn’t get the question right at first but you also need to change the CSS, .gallery>div>img means an element with class gallery immediately followed by a div immediately followed by an img, to include both img and a tags you need to remove the > “.gallery>div img”

Try This Code

HTML & CSS

Working Fiddle

Hope this Helps..