Page 1 of 1

Navigation - back

Posted: Sun Apr 29, 2018 11:18 am
by Timo
How to make the navigation more intuitive to go to previous bookmark when the browser's back button is clciked?

Re: Navigation - back

Posted: Mon Apr 30, 2018 12:03 am
by admin
Timo,

I don't understand your question.

Steven

Re: Navigation - back

Posted: Mon Apr 30, 2018 6:15 am
by Timo
Sorry I mean breadcrumb

Re: Navigation - back

Posted: Tue May 01, 2018 1:23 am
by admin
Timo,

Sorry, but more intuitive Is a pretty open-ended thing to say, so I still don't understand what you mean.

Steven

Re: Navigation - back

Posted: Tue May 01, 2018 7:41 am
by Timo
Users expect the back button to take them back to what they perceived to be their previous page.

Back button:
Image

Example: Edit form is open, user hits the browser's back button. Expectation: Takes you back to the Browse form. What happens: Nothing.
Take Joomla as an example: The browser's back button works as expected (takes you to the previous page). Additionaly, breadcrumbs can be used, too.

Re: Navigation - back

Posted: Tue May 01, 2018 9:15 am
by admin
Timo,

The back button reloads a whole web page - nuBuilder rebuilds pages without reloading a new page.

If your users find this an insurmountable problem you have two choices.

1. Fork nuBuilder and make the changes you want.
2. Try to get Joomla to do what nuBuilder does.

Steven

Re: Navigation - back

Posted: Tue May 01, 2018 2:51 pm
by toms
Here's another option: This will "disable/intercept" the browser's back button and take you back to the previous breadcrumb:

Add this js under Home ► Setup ► Header:

Code: Select all

function gotoPrevBreadcrumb() {
    var l = window.nuFORM.breadcrumbs.length;
    if (l > 1) {
        nuGetBreadcrumb(l - 2);
    }
}

function nuOnLoad() {

    window.history.pushState({ page: 1}, "", "");
    window.onpopstate = function(event) {
        if (event) {
             gotoPrevBreadcrumb();
        } else {}
    };
}  

Re: Navigation - back

Posted: Wed May 02, 2018 5:34 am
by toms
Small improvement: Works also if a modal window is open.

Code: Select all

function gotoPrevBreadcrumb() {

    if (parent.$('#nuModal').length > 0) {
        nuClosePopup();
        return;
    }

    var l = window.nuFORM.breadcrumbs.length;
    if (l > 1) {
        nuGetBreadcrumb(l - 2);
    }
}


function nuOnLoad() {

    window.history.pushState({ page: 1}, "", "");
    window.onpopstate = function(event) {
        if (event) {
            gotoPrevBreadcrumb();
        } else {
        }
    };
  
}

Re: Navigation - back

Posted: Wed May 02, 2018 8:09 pm
by Timo
@Steven: Forking nuBuilder for just that function is no option for me. And to migrate all my projects to joomla just because of a function that is not there is no option either.
@toms: This is exactly what I was looking for :D This should be included in nuBuilder.@

Re: Navigation - back

Posted: Thu May 03, 2018 12:21 am
by admin
.