Skip to content

Commit c6a7e64

Browse files
committed
resolve #36
1 parent 9456ee7 commit c6a7e64

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

_layouts/post.html

+17
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,20 @@ <h4 class="post-title">{{ post.title }}</h4>
5858
</a>
5959
</div>
6060
{% endfor %} {% endif %}
61+
<div id="overlay"></div>
62+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
63+
<script type="text/javascript">
64+
$overlay = $('#overlay');
65+
66+
$('img').click(function(){
67+
$overlay.fadeTo(200, 1).css({
68+
backgroundImage: 'url('+this.src+')',
69+
backgroundSize: 'contain'
70+
});
71+
});
72+
$overlay.click(function(){
73+
$(this).stop().fadeTo(200,0,function(){
74+
$(this).hide();
75+
});
76+
});
77+
</script>

_sass/_posts.scss

+16
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,19 @@
4646
.related-post-title {
4747
border-bottom: thin solid #f3f3f3;
4848
}
49+
50+
#overlay{
51+
display:none;
52+
position:fixed;
53+
top:0;
54+
left: 0;
55+
width:100%;
56+
height:100%;
57+
background-color:rgba(0,0,0,0.4);
58+
background-repeat:no-repeat;
59+
background-position: center center;
60+
cursor:pointer;
61+
}
62+
.post-content img {
63+
cursor: pointer;
64+
}

0 commit comments

Comments
 (0)