Skip to content

Commit dd7a474

Browse files
committed
Fix #8 Make github-buttons hide on mobile
The button will be hidden on mobile portrait mode, they are still visible on landscape mode on most phone. Signed-off-by: Tao Wang <[email protected]>
1 parent c9936f0 commit dd7a474

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

_layouts/website/page.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22

33
{% block head %}
44
{{ super() }}
5+
<style>
6+
@media only screen and (max-width: 640px) {
7+
.book-header .hidden-mobile {
8+
display: none;
9+
}
10+
}
11+
</style>
512
<script>
613
window["gitbook-plugin-github-buttons"] = {{ config.pluginsConfig['github-buttons']|dump|safe }};
714
</script>
8-
{% endblock %}
15+
{% endblock %}

src/plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ require(['gitbook'], function (gitbook) {
1515
var width = size === "large" ? "170" : "160";
1616
var height = size === "large" ? "30" : "20";
1717
var extraParam = type === "watch" ? "&v=2" : "";
18-
return `<a class="btn pull-right" aria-label="github">
18+
return `<a class="btn pull-right hidden-mobile" aria-label="github">
1919
<iframe style="display:inline-block;vertical-align:middle;" src="https://ghbtns.com/github-btn.html?user=${user}&repo=${repo}&type=${type}&count=${count}&size=${size}${extraParam}" frameborder="0" scrolling="0" width="${width}px" height="${height}px"></iframe>
2020
</a>`;
2121
}

0 commit comments

Comments
 (0)