Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement sticky navbar in css #1016

Merged
merged 3 commits into from
May 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# pkgdown 1.3.0.9000 (development version)

* The sticky behavior of the navbar is now implemented in pure CSS instead of relying on the 3rd party javascript library (#1016, @bisaloo)

* Allow setting hard timeout for build_site(new_process = TRUE) via options('pkgdown.timeout').
Thereby stalled builds in a cron job can get killed automatically, preventing the
process from hanging indefinitely.
Expand Down
3 changes: 3 additions & 0 deletions inst/assets/pkgdown.css
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ a.anchor {

#sidebar {
margin-top: 30px;
position: -webkit-sticky;
position: sticky;
top: 70px;
}
#sidebar h2 {
font-size: 1.5em;
Expand Down
9 changes: 0 additions & 9 deletions inst/assets/pkgdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@
(function($) {
$(function() {

$("#sidebar")
.stick_in_parent({offset_top: 40})
.on('sticky_kit:bottom', function(e) {
$(this).parent().css('position', 'static');
})
.on('sticky_kit:unbottom', function(e) {
$(this).parent().css('position', 'relative');
});

$('body').scrollspy({
target: '#sidebar',
offset: 60
Expand Down
3 changes: 0 additions & 3 deletions inst/templates/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>

<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>

<!-- pkgdown -->
<link href="{{#site}}{{root}}{{/site}}pkgdown.css" rel="stylesheet">
<script src="{{#site}}{{root}}{{/site}}pkgdown.js"></script>
Expand Down