修复文章图片不弹起

This commit is contained in:
我是一只虫子 2020-11-05 22:48:34 +08:00
parent 282eefca30
commit 22d0ccc701
4 changed files with 16 additions and 29 deletions

BIN
.DS_Store vendored

Binary file not shown.

BIN
layout/.DS_Store vendored

Binary file not shown.

Binary file not shown.

View File

@ -4,39 +4,26 @@
</div> </div>
</div> </div>
<style> <style>
@media screen and(min-width:600px) { #noneimg img {
.noneimg { display: none;
cursor: pointer; z-index: 109;
display: none; width: 600px !important;
z-index: 109; border-radius: 0px;
width: 600px; position: fixed;
height: auto; box-shadow: 0 0 0px #c3c3c300 !important;
position: fixed; left: 0;
left: 0; top: 0;
top: 0; right: 0;
right: 0; bottom: 0;
bottom: 0; margin: auto !important;
margin: auto
}
} }
@media screen and(max-width:600px) { @media screen and (max-width:600px) {
.noneimg { #noneimg img {
cursor: pointer; width: 88%
display: none;
z-index: 109;
width: 88%;
height: auto;
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
margin: auto
} }
} }
</style> </style>
<script> <script>
$(function () { $('body').click(function (e) { if ($('.noneimg').length !== 0 && $('.nonediv').length !== 0) { $(".noneimg").fadeOut("slow"); $(".nonediv").fadeOut("slow"); setTimeout(function () { $('.noneimg').remove(); $('.nonediv').remove() }, 800) } else { if (e.target.tagName == "IMG") { let imgUrl = "<img class='noneimg' style='border-radius: <%=theme.picture.imgRadius %>;' src='" + e.target.currentSrc + "'>"; let MDiv = "<div class='nonediv' style='cursor: pointer;display: none; position: fixed;left: 0;top: 0; right: 0;bottom: 0;background-color: <%= theme.picture.colour %>;opacity:<%= theme.picture.opacity %>;z-index: 108;'></div>"; $('body').append(MDiv); $('body').append(imgUrl); $(".noneimg").fadeIn("slow"); $(".nonediv").fadeIn("slow") } } }); $('.article-content').addClass('content-move') }); $(function () { $('#article').click(function (e) { if (e.target.tagName == "IMG") { if ($('#nonediv').length == 0) { let MImg = `<div id='noneimg'><img src='${e.target.currentSrc}'></div>`; let MDiv = "<div id='nonediv' style='cursor: pointer;display: none; position: fixed;left: 0;top: 0; right: 0;bottom: 0;background-color: <%= theme.picture.colour %>;opacity:<%= theme.picture.opacity %>;z-index: 108;'></div>"; $('#article').append(MDiv); $('#article').append(MImg); $("#nonediv").fadeIn("slow"); $("#noneimg img").fadeIn("slow") } } else { if ($('#nonediv').length !== 0) { $("#noneimg ").fadeOut("slow"); $("#nonediv").fadeOut("slow"); setTimeout(function () { $('#nonediv').remove(); $('#noneimg').remove() }, 500) } } }); $('.article-content').addClass('content-move') });
</script> </script>