水平滚动触摸菜单?
我正在构建一个移动网站,客户希望顶部有一个菜单栏。菜单很宽,所以他希望通过左右拖动来水平滚动。 app.ft.com 具有类似的功能(尽管您必须在 iPhone 上查看它才能看到它的工作原理)
有谁知道可以实现此目的的 jQuery / jqTouch 脚本吗?我尝试过scrollTouch,但只能滚动整个页面,而不仅仅是菜单。
I am building a mobile website, and the client wants a menu bar at the top. The menu is very wide, so he wants it to be horizontally scrolled by dragging it left and right. app.ft.com has similar functionality (although you must view this on on an iPhone to see it working)
Does anyone know of a jQuery / jqTouch script that can achieve this? I have tried scrollTouch, but that only scrolls the whole page, not just a menu.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我为 jQuery Mobile 编写了一个带有图像的简单水平导航栏,您可以通过在移动设备上向左或向右拖动它来滚动该导航栏。这个例子非常粗略,但它会给你一个总体思路。标记如下:
CSS:
HTML 标记:
JavaScript:
请记住,在 jQuery Mobile 中启用 AJAX 导航时,不建议使用 $(document).ready(),因此您可能需要定制此解决方案以满足您自己的需求。
I wrote a simple horizontal navigation bar with images for jQuery Mobile that you can scroll by dragging it left or right on mobile devices. This example is very crude but it will give you the general idea. The markup is below:
CSS:
HTML Markup:
JavaScript:
Keep in mind that $(document).ready() is not recommended when AJAX navigation is enabled in jQuery Mobile, so you might need to tailor this solution to fit your own needs.
纯 CSS 解决方案,利用移动浏览器不创建任何滚动条的事实。内部的某种视觉引导和自动宽度会很好,但并不总是需要。
JSFiddle 可以使用 http://jsfiddle.net/KaGrc/1
CSS:
HTML:
A css only solution, utilizing the fact that mobile browsers does'nt create any scrollbars. Some kind of visual guidance and auto-width for the inner one would be good but is not always needed.
JSFiddle to play with http://jsfiddle.net/KaGrc/1
CSS:
HTML:
尝试cubiq.org 的 iScroll 4。它可以应用于页面上的任何 div,水平、垂直或双向滚动,有一个漂亮的动画(就像在智能手机上一样),在 webkit 和 Firefox 中速度非常快(其他的更糟),最重要的是,它是相当可定制的。我花了 12 个小时寻找这样的滚动条,这基本上满足了我的所有需求。
Try iScroll 4 by cubiq.org. It can be applied to any div on page, horizontal, vertical or both scrolling, have a nice animation (just like on smartphones), is very fast in webkit and Firefox (others are worse) and most of all, is pretty customizable. I spend a 12 hours looking for such scroller and this covers basically all my needs.
看看这个
http://plugins.jquery.com/project/ Touchwipe-iPhone-iPad-擦拭手势
Take a look at this
http://plugins.jquery.com/project/Touchwipe-iPhone-iPad-wipe-gesture