cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

How to disable sliding animation when changing views

AY2021S1
6-Contributor

How to disable sliding animation when changing views

How to disable sliding animation when changing views.

For example, when changing from view 1 to view 2, there is a sliding animation. how do I disable it?

 

Thank you

2 REPLIES 2
Jimwang
14-Alexandrite
(To:AY2021S1)

Is it due to that it takes long time to load View 2?

Hi @AY2021S1 ,

 

there is so far I know no such supported setting in Vuforia Studio ,. When I check the current implementation of twx.app.fn.navigate(target) but also $scope.navigate(target) // is the same// :

 

 

 

twx.app.fn.navigate = function (target) {
        if( window.location.hash.indexOf('#/tab/') >= 0 ) {
            window.location.hash = '#/tab/' + target;
        } else {
            window.location.hash = '#/' + target;
        }
    }; 

 

 

 

So as we can see this the default setting of the window.location.hash. So we can try some techniques to change the default behavior, but I am not sure if we can override it simple.

In some forums we can find some hints , but I did test it very detailed:

1.) https://stackoverflow.com/questions/1489624/modifying-location-hash-without-page-scrolling

2.) https://stackoverflow.com/questions/49161602/javascript-change-window-location-hash-without-scrolling-but-still-trigger-css

3.) https://stackoverflow.com/questions/3870057/how-can-i-update-window-location-hash-without-jumping-the-document/14690177

So, I did test only one possible suggestion but I did not get different behavior after quick test in the preview and on Android, but you can still test may be at least it could work.

So, test something like this:

 

 

function changeHashWithoutScrolling(hash) {
var id = hash.replace(/^.*#/, '')
  if(history.pushState)   history.pushState(null, null,hash);
  else  window.location.hash = hash;
}
//====================
$scope.MyNav = function (target) { 
  pushHashAndFixTargetSelector('#/' + target)
}
//
$scope.MyNav("Home")

 

 

Top Tags