Skip to main content
1-Visitor
April 21, 2020
Question

How to disable sliding animation when changing views

  • April 21, 2020
  • 2 replies
  • 1232 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

16-Pearl
April 23, 2020

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

21-Topaz I
April 23, 2020

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")