Skip to content

Commit 243e603

Browse files
authored
Merge pull request #8621 from readthedocs/davidfischer/floating-ad-placement
Floating ad placement for docs.readthedocs.io
2 parents 789983d + 7c44ab5 commit 243e603

File tree

3 files changed

+55
-1
lines changed

3 files changed

+55
-1
lines changed

docs/_static/css/custom.css

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,46 @@
22
border-radius: 50%;
33
box-shadow: 0 0 0 7px #fff, 0 0 0 8px #cecece;
44
margin: 9px 17px 9px 3px;
5-
}
5+
}
6+
7+
8+
/* RTD docs ad placement in the lower right */
9+
#rtd-stickybox {
10+
z-index: 1000;
11+
position: fixed;
12+
bottom: 20px;
13+
right: 20px;
14+
}
15+
#rtd-stickybox .ea-content {
16+
background: rgba(230, 230, 230);
17+
}
18+
#rtd-stickybox .stickybox-hide {
19+
cursor: pointer;
20+
position: absolute;
21+
top: 0.5rem;
22+
right: 0.5rem;
23+
24+
background-color: #fefefe;
25+
border: 1px solid #088cdb;
26+
border-radius: 50%;
27+
color: #088cdb;
28+
font-size: 0.75rem;
29+
text-align: center;
30+
height: 1rem;
31+
width: 1rem;
32+
}
33+
34+
/* Placement under content on smaller screens/tablets/mobile */
35+
@media (max-width: 1340px) {
36+
#rtd-stickybox {
37+
position: static;
38+
bottom: 0;
39+
right: 0;
40+
margin: auto;
41+
text-align: center;
42+
}
43+
44+
#rtd-stickybox .stickybox-hide {
45+
display: none;
46+
}
47+
}

docs/_templates/ethicalads.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<div id="rtd-stickybox">
2+
<div class="stickybox-hide" onclick="document.querySelector('#rtd-stickybox').remove();">&#215;</div>
3+
<div class="raised" data-ea-publisher="readthedocs" data-ea-type="image"></div>
4+
</div>

docs/_templates/layout.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{% extends "sphinx_rtd_theme/layout.html" %}
2+
3+
4+
{% block document %}
5+
{{ super() }}
6+
7+
{% include "ethicalads.html" %}
8+
{% endblock document %}

0 commit comments

Comments
 (0)