Make the switcher sticky at the top of the page

pull/16/head
Christoph Zwerschke 4 years ago
parent 689ec0111f
commit 29959d2e8c

@ -8,6 +8,13 @@
body {
padding-left: 24px;
}
#switcher {
position: sticky;
top: 0;
padding-bottom: 9px;
background: white;
box-shadow: 0 2px 1px -1px #ccc;
}
</style>
<script type="text/javascript">
function quick_api() {
@ -413,6 +420,6 @@
<p>View this project on <a href="https://github.com/dohliam/dropin-minimal-css">GitHub</a>.</p>
</footer>
</div>
<script src="https://dohliam.github.io/dropin-minimal-css/switcher.js" type="text/javascript"></script>
<script src="./switcher.js" type="text/javascript"></script>
</body>
</html>

@ -40,10 +40,11 @@ function add_switcher() {
head.appendChild(link);
}
var new_div = document.createElement("div");
new_div.innerHTML = ' <div id="switcher">&nbsp;</div>\n <script type="text/javascript">inline_switcher();</script>';
var new_div = document.createElement('div');
new_div.id = 'switcher';
new_div.innerHTML = ' <div>&nbsp;</div>\n <script type="text/javascript">inline_switcher();</script>';
document.body.insertBefore(new_div, document.body.firstChild);
document.body.style.paddingLeft = "24px"
document.body.style.paddingLeft = "24px";
inline_switcher();
}

Loading…
Cancel
Save