【发布时间】:2015-06-14 06:27:06
【问题描述】:
某些应用程序(facebook、9gag)具有此功能。当用户向上滚动导航栏时,导航栏会逐渐隐藏到消失的位置。然后当用户向下滚动时,navigationBar 会逐渐显示出来(取决于滚动的速度)。
我们尝试在 Titanium 上通过调整滚动事件上导航视图的高度来实现这一点,但它滞后且非常缓慢:
scrollView.addEventListener('touchstart',function(e){
boolScroll=true;
});
scrollView.addEventListener('scroll',function(e){
if(boolScroll){
auxScroll=e.y;
boolScroll=false;
}
var bh=bars.height;
var sh=scrolls.height;
if(auxScroll<e.y)//scrolling down
if(bars.height>appHeight*0.08){
bars.height=bh-appHeight*0.005; //rate for hiding
if(scrolls.height<appHeight*0.7)
scrolls.height=sh+appHeight*0.005;//same rate to increase the height of the scroll
}
if(auxScroll>e.y)//scrolling up
if(bars.height<appHeight*0.08){
bars.height=bh+appHeight*0.005;
if(scrolls.height>appHeight*0.7)
scrolls.height=sh-appHeight*0.005;
}
});
我们也尝试过在视图上使用平移动画,但仍然很慢。
this 问题上有一个适用于 iOS 的解决方案。任何帮助将不胜感激!
【问题讨论】:
-
Titanium JIRA jira.appcelerator.org/browse/TIMOB-18912 中有一个未解决的问题,但一年没有人碰它。 :(
标签: javascript titanium scrollview navbar