allow users to return to article list and select blog button when visiting directly from a link
This commit is contained in:
parent
cb452398f9
commit
f2b1b230ff
1 changed files with 6 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
|||
let selectedButtonId = 'button-home';
|
||||
const loadedScripts = [];
|
||||
|
||||
let selectedButtonId = 'button-home';
|
||||
|
||||
const changeSelected = (buttonId) => {
|
||||
A(`#${selectedButtonId}`).removeClass('button-selected');
|
||||
A(`#${buttonId}`).addClass('button-selected');
|
||||
|
@ -77,12 +78,15 @@ const dynamicRoutesActions = {
|
|||
peformRouteAction('/404');
|
||||
return;
|
||||
}
|
||||
|
||||
changeSelected(getButtonFromPathname('/blog'));
|
||||
blogVisitArticle(arg, desc);
|
||||
}
|
||||
};
|
||||
|
||||
const onButtonClick = (buttonId) => {
|
||||
if (selectedButtonId === buttonId) {
|
||||
// The condition after && is kinda of a hack, the reason I do this is because I want users to be able to click the blog button and return to the article list to continue reading when they are already on an article.
|
||||
if (selectedButtonId === buttonId && buttonId !== 'button-blog') {
|
||||
return;
|
||||
}
|
||||
changeSelected(buttonId);
|
||||
|
|
Loading…
Reference in a new issue