added fucntion to the close button

This commit is contained in:
Václav Šmejkal 2024-05-25 15:36:40 +02:00
parent 907183fab1
commit a51c40fc48
Signed by: ENGO150
GPG Key ID: 4A57E86482968843

View File

@ -9,7 +9,8 @@
<div><button onclick="upload()" type="submit" class="btn" id="upload_popup_sub">Zveřejnit</button></div> <div><button onclick="upload()" type="submit" class="btn" id="upload_popup_sub">Zveřejnit</button></div>
</div> </div>
<div id="image_popup"> <div id="image_popup">
<img src="//:0"> <img id="image_popup_img" src="//:0">
<img id="close_btn" onclick="close_image()" src="./res/forum/images/close.png" alt="Tlačítko pro zavření obrázku">
</div> </div>
<div id="posts"></div> <div id="posts"></div>
@ -96,7 +97,12 @@
$(document).on("click", ".post_image", function(event) $(document).on("click", ".post_image", function(event)
{ {
$("#image_popup").css("display", "flex"); $("#image_popup").css("display", "flex");
$("#image_popup").children("img").attr("src", $(this).children("img").attr("src")); $("#image_popup").children("#image_popup_img").attr("src", $(this).children("img").attr("src"));
$("#image_popup").children("img").attr("alt", $(this).parent(".post").children(".post_info").children("div").children(".post_name").html()); $("#image_popup").children("#image_popup_img").attr("alt", $(this).parent(".post").children(".post_info").children("div").children(".post_name").html());
}); });
function close_image()
{
$("#image_popup").css("display", "none");
}
</script> </script>