lesson : https://youtu.be/me2pu6JcNfo
Created
September 27, 2022 10:21
-
-
Save nakulkundra/0a2f66ca7b7f10f1c5240323d524136c to your computer and use it in GitHub Desktop.
image popup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="popup"> | |
<img src="https://exmaxqc.advantagego.com/AdGo.EMAXQC.WebApp/assets/HelpGuide/assets/images/t1_user_profile_01.png"> | |
</div> | |
<div class="show"> | |
<div class="overlay"></div> | |
<div class="img-show"> | |
<span><svg id="Cross" viewBox="0 0 1000 1000"> | |
<path d="M200,250l250,250l-250,250l50,50l250,-250l250,250l50,-50l-250,-250l250,-250l-50,-50l-250,250l-250,-250z"></path> | |
</svg></span> | |
<img src=""> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function () { | |
"use strict"; | |
$(".popup img").click(function () { | |
var $src = $(this).attr("src"); | |
$(".show").fadeIn(); | |
$(".img-show img").attr("src", $src); | |
}); | |
$("span, .overlay").click(function () { | |
$(".show").fadeOut(); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.show { | |
z-index: 999; | |
display: none; | |
} | |
.show .overlay { | |
width: 100%; | |
height: 100%; | |
background: rgba(0, 0, 0, 0.66); | |
position: absolute; | |
top: 0; | |
left: 0; | |
} | |
.show .img-show { | |
background: #fff; | |
position: absolute; | |
top: 50%; | |
left: 50%; | |
zoom: 1.5; | |
transform: translate(-50%, -50%); | |
overflow: auto; | |
display: block; | |
} | |
.img-show span { | |
position: absolute; | |
top: 10px; | |
right: 10px; | |
z-index: 99; | |
cursor: pointer; | |
} | |
.img-show span svg { | |
height: 2vh; | |
} | |
.img-show img { | |
} | |
/*End style*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment