refactor: Extract modal backdrop close and scrollToTop to functions
- Add closeOnBackdrop(modal, evt) to utils._hs for modal backdrop clicks - Add scrollToTop(evt) to utils._hs for smooth scroll to top - Simplify 3 modal templates (shortcuts, info, pdf) from 4 lines to 1 - Simplify back-to-top button from 3 lines to 1
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
{{define "shortcuts-modal"}}
|
||||
<!-- Keyboard Shortcuts Modal - Native Dialog -->
|
||||
<dialog id="shortcuts-modal" class="info-modal no-print"
|
||||
_="on click
|
||||
if event.target is me
|
||||
call me.close()
|
||||
end">
|
||||
_="on click call closeOnBackdrop(me, event)">
|
||||
<div class="info-modal-content">
|
||||
<button class="info-modal-close" onclick="document.getElementById('shortcuts-modal').close()" aria-label="{{if eq .Lang "es"}}Cerrar{{else}}Close{{end}}">
|
||||
<iconify-icon icon="mdi:close" width="24" height="24"></iconify-icon>
|
||||
|
||||
Reference in New Issue
Block a user