Adding a back button when profiles are open.

This commit is contained in:
Jason Williams
2022-11-20 18:26:36 -07:00
parent 56e0ceeaae
commit a9ac160c85
4 changed files with 45 additions and 8 deletions

View File

@@ -24,12 +24,12 @@ $(() => {
};
// Handle clicks on profile links (by doing nothing)
$('a.openlink').click(function(e) {
$('a.openlink, a.closelink').click(function(e) {
e.preventDefault();
})
// Handle clicks on the banner
$('div.banner').click(function() {
$('div.banner, div#backbutton').click(function() {
// If there's no person to open, do nothing
if (typeof $(this).attr('data-person') == 'undefined') return;
@@ -134,6 +134,14 @@ $(() => {
queue: true
})
$('#backbutton').animate({
top: '-3rem',
right: '-3rem'
}, {
duration: 300
})
if (window.matchMedia('(orientation: portrait)').matches) {
// If we're closing in portrait mode...
$('.main.not' + p).css('width', '100vw')
@@ -178,13 +186,19 @@ $(() => {
}
}
// Animate the display of links for a defined person
// Animate the display of links for a defined person, and show the back button
function animateLinks(p) {
$('#links-' + p).animate({
height: $('#links-' + p).get(0).scrollHeight
}, {
duration: 300,
queue: true
duration: 300
})
$('#backbutton').animate({
top: '2.5rem',
right: '2.5rem'
}, {
duration: 300
})
}
})