-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a loading spinner to our main nav; fixes #378
- Loading branch information
Showing
3 changed files
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// add a spinner to our navlinks when turbolinks:click is triggered | ||
$(document).on('turbolinks:click', function(event){ | ||
var $target = $(event.target); | ||
|
||
if ($target.is('#mainnav .nav-link')) { | ||
$target.append('<div class="flex-center nav-spinner"><div class="spinner-border text-primary" role="status"><span class="sr-only">Loading...</span></div></div>'); | ||
} | ||
}); | ||
|
||
// remove the spinner after the new page loads (or is being written to the cache) | ||
$(document).on('turbolinks:load turbolinks:before-cache', function(){ | ||
$('#mainnav .nav-spinner').remove(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.nav-spinner { | ||
height: 2rem; | ||
margin-top: -3rem; | ||
margin-bottom: 1rem; | ||
} |