Skip to content

Instantly share code, notes, and snippets.

@ttamg
Created May 26, 2019 18:03
Show Gist options
  • Save ttamg/502f084dfe88d767a8cbab3eef71524e to your computer and use it in GitHub Desktop.
Save ttamg/502f084dfe88d767a8cbab3eef71524e to your computer and use it in GitHub Desktop.
A simple refresh icon that can be added to the navbar at the #refresh id in the DOM. Call needsRefresh() to add the icon.
// Add refresh app icon
function needsRefresh() {
$('#refresh').empty();
html = `
<button class="btn" data-toggle="tooltip" title="Click to refresh app"><i data-feather="refresh-cw" onclick="refresh();"></i></button>
`
$('#refresh').append(html);
$('[data-toggle="tooltip"]').tooltip()
feather.replace()
}
// Refresh the app
function refresh() {
$('#refresh').empty();
location.reload();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment