在 javascript Windows 8 Metro 风格应用程序中切换应用栏的事件是什么?
我正在寻找在 javascript 中切换应用栏的事件。所以它基本上是屏幕上/下边缘上的“边缘滑动”手势事件。
例如,我想当用户滑动屏幕的上边缘或下边缘时在页面上显示文本“边缘滑动”,而不在页面中声明应用程序栏。我怎样才能做到这一点?
我尝试了 crossslide 事件,但似乎不正确。
I am looking for the event that toggles the appbar in javascript. So it's basically the "edge-swipe" gesture event on the top/bottom edge of the screen.
For example, I want to show a text "edge swiped" on the page when the user swipe the upper or butto edge of the screen, without declaring a app bar in the page. How will I be able to do that?
I tried crossslide event and it doesn't seem to be right.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
的文档
您可以在此处查看AppBar 有四个事件:afterhide、aftershow、beforehide 和 beforeshow。
有关更多详细信息,请查看文档
you can see the documentation for AppBar here
Appbar has four events: afterhide, aftershow, beforehide and beforeshow.
Check the documentation for more details
横向滑动不适合你,因为它是一种可以从任何地方开始的手势。
Metro 应用程序不会公开任何边缘滑动事件。 Windows 8 会检测边缘滑动并自动为您升起应用程序栏(如果您有应用程序栏)。
也许他们将来会添加一个,但谁知道是否或何时添加,所以你可能想要进行自己的手势跟踪。我建议您查看 PointerPoint 类并构建您自己的自定义手势识别器。
基本的边缘滑动应该很容易识别,但您必须注意屏幕上的所有指针。例如,如果我有一台跟踪 5 个手指且其中一个是边缘滑动的平板电脑,那么无论或仅当当时有一个活动的触摸点时,您是否都能识别该手势?这取决于你。
Cross-slide won't work for you because it's a gesture that can start anywhere.
There's no edge-slide event that is exposed to a Metro app. Windows 8 detects the edge-slide and raises the app bar for you automatically (when you have one).
Maybe they'll add one in the future, but who know's if or when, so you'll probably want to do your own gesture tracking. I'd suggest you have look at the PointerPoint class and building your own custom gesture recognizer.
A basic edge swipe should be easy enough to recognize, though you'll have to pay attention to all the pointers on screen. For example, if I have a tablet that tracks 5 fingers and one of them edge-slides, do you recognize the gesture regardless or only if there is a single touch point active at the time? That's up to you.