Today will learn How to show image as a popup on click the link using Jquery. This is very simple concept will easily do with the help of jquery. You can customize the popup image by editing jquery.fancybox file. In this file you can set the speed of the animation open image in the popup and also you can set the loop and opacity, zoom option etc...
In this example you should add the image to div with the id name is hidden-content that image will display in the popup field. And then you just call the id hidden-content in the <a> tag like below code after included necessary jquery and javascript and css files. This post shows image in the popup window while clicking the link. You can also add the link in the popup image by using <a> tag in your hidden-content div.
<a data-fancybox data-src="#hidden-content" href="javascript:;">
Click link View popup image
</a>
I hope this example will help you how to open an image in the popup mode on click the link. Below is the full code you can download code and use it your projects. And also i provided the demo link check it out below. I think this is very useful to you, If it is useful please support us by sharing this post to social media. Thanks lot.
Code for onclick Popup image:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Popup image on click the link using Jquery</title>
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="jquery.fancybox.css">
</head>
<body>
<br/><br/><br/><br/><br/><br/>
<center><!-- Your HTML content goes here -->
<div style="display: none;" id="hidden-content">
<img src="sanwebcorner.jpg" />
</div>
<a data-fancybox data-src="#hidden-content" href="javascript:;">
Click link View popup image
</a>
<br/><br/><br/><br/><br/><br/>
<a href="http://www.sanwebcorner.com">www.sanwebcorner.com</a>
</center>
<!-- JS -->
<script src="http://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="jquery.fancybox.js"></script>
</body>
</html>
0 Comments