Skip to content

Commit cba3ad2

Browse files
add WeChat to socials (alshedivat#1730)
When the WeChat icon in socials is clicked, a picture of your WeChat QR code is shown in the center of the screen. The actual picture of your QR code has to be uploaded.
1 parent 8883c9d commit cba3ad2

File tree

5 files changed

+60
-1
lines changed

5 files changed

+60
-1
lines changed

_config.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ facebook_id: # your facebook id
105105
youtube_id: # your youtube channel id (youtube.com/@<youtube_id>)
106106
discord_id: # your discord id (18-digit unique numerical identifier)
107107
zotero_username: # your zotero username
108+
wechat_qr: # filename of your wechat qr-code saved as an image (e.g., wechat-qr.png if saved to assets/img/wechat-qr.png)
108109

109110
contact_note: >
110111
You can even add a little note about which of these is the best way to reach you.
@@ -425,4 +426,4 @@ jsonresume:
425426
- skills
426427
- languages
427428
- interests
428-
- references
429+
- references

_includes/scripts/wechatModal.html

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{% if site.wechat_qr %}
2+
3+
<!-- WeChat Modal -->
4+
5+
<script>
6+
var wechatModal = document.getElementById("WeChatMod");
7+
var wechatBtn = document.getElementById("WeChatBtn");
8+
9+
wechatBtn.onclick = function() {
10+
wechatModal.style.display = "block";
11+
}
12+
13+
window.onclick = function(event) {
14+
if (event.target == wechatModal) {
15+
wechatModal.style.display = "none";
16+
}
17+
}
18+
</script>
19+
20+
{% endif %}

_includes/social.html

+7
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,10 @@
109109
{%- if site.rss_icon -%}
110110
<a href="{{ site.baseurl }}/feed.xml" title="RSS Feed"><i class="fas fa-rss-square"></i></a>
111111
{% endif %}
112+
{%- if site.wechat_qr -%}
113+
<a id="WeChatBtn" title="WeChat"><i class="fab fa-weixin"></i></a>
114+
<div id="WeChatMod" class="wechat-modal">
115+
<img src="{{ site.wechat_qr | prepend: 'assets/img/' | relative_url }}" alt="WeChat QR" id="WeChatQR">
116+
</div>
117+
{% include scripts/wechatModal.html %}
118+
{% endif %}

_layouts/default.html

+1
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,6 @@
5858
{% include scripts/mathjax.html %}
5959
{% include scripts/analytics.html %}
6060
{% include scripts/progressBar.html %}
61+
{% include scripts/wechatModal.html %}
6162
</body>
6263
</html>

_sass/_base.scss

+30
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,36 @@ blockquote {
326326
}
327327
}
328328

329+
.wechat-modal {
330+
display: none;
331+
position: fixed;
332+
z-index: 1;
333+
padding-top: 100px;
334+
left: 0;
335+
top: 0;
336+
width: 100%;
337+
height: 100%;
338+
overflow: auto;
339+
background-color: rgb(0,0,0);
340+
background-color: rgba(0,0,0,0.8);
341+
}
342+
343+
.wechat-modal > img {
344+
display: block;
345+
position: relative;
346+
top: 50%;
347+
left: 50%;
348+
width: 33%;
349+
max-width: 400px;
350+
transform: translate(-50%, -50%);
351+
}
352+
353+
@media only screen and (max-width: 400px){
354+
.wechat-modal > img {
355+
width: 100%;
356+
}
357+
}
358+
329359

330360
// Footer
331361
footer.fixed-bottom {

0 commit comments

Comments
 (0)