jquery mobile splitview:支持屏幕的问题

发布于 2025-01-07 11:02:16 字数 603 浏览 0 评论 0原文

您好,我正在使用 jquery mobile 和 splitview 插件
http://asyraf9.github.com/jquery-mobile/
我无法解决的是为什么 splitview 插件只能在满足以下条件的屏幕上使用。

 var $query = $.mobile.media('screen and (min-width: 480px)') && ($.mobile.media('(-webkit-max-device-pixel-ratio: 1.2)') || $.mobile.media('max--moz-device-pixel-ratio: 1.2)'));
 $.support.splitview = ($query || ($.mobile.browser.ie && $(this).width() >= 480)) && $.mobile.ajaxEnabled;

splitview 插件适用于所有屏幕,但对于不满足上述条件的较小屏幕,存在一些滚动错误。它不能正确滚动。如果不满足这些条件,我们不能修复这些问题而不是完全不使用 splitview 插件吗。
保留这些条件是否有特殊原因? 请帮忙。

Hi i am using jquery mobile and alongwith the splitview plugin
http://asyraf9.github.com/jquery-mobile/

what i couldnt get around to was that why was the splitview plugin made to work only with screens which satisfy the following condition.

 var $query = $.mobile.media('screen and (min-width: 480px)') && ($.mobile.media('(-webkit-max-device-pixel-ratio: 1.2)') || $.mobile.media('max--moz-device-pixel-ratio: 1.2)'));
 $.support.splitview = ($query || ($.mobile.browser.ie && $(this).width() >= 480)) && $.mobile.ajaxEnabled;

the splitview plugin works for all screens, but there are some scrolling bugs for smaller screens which dont satisfy the above conditions. it doesnt scroll properly. cant we fix those instead of not using splitview plugin entirely if these conditions are not met.
Is there a particilar reason why these conditions were kept?
Please help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不打扰别人 2025-01-14 11:02:16

问题似乎出在 jquery.mobile.splitview.css 中的这行 CSS (line:75)

-webkit-overflow-scrolling:touch;

如果您将其注释掉,滚动错误就会消失但 ul 元素没有任何动量。

启用原生动量滚动似乎是 iOS5 的特定规则。请参阅http://johanbrook.com/browsers/native-momentum-scrolling- ios-5/

CSS 修复

使页面滚动动量

#search .ui-content {
 -webkit-transform: translate3d(0, 0, 0);
}

#search-list {
 position:  static;
 overflow:  scroll;
}

#search 是 page-id,#search list 是 ul 元素。但现在看来,向左和向右滑动似乎分别变成了向上和向下滑动。诡异的。

JS 修复(推荐)

在第 527 行,如果 jquery.mobile.splitview.js 进行以下更改

//if ($.support.touch && !$.support.touchOverflow) {
if($.support.touch){

,这会强制运行使用 iScroll.js 的后备代码。

我认为 JS 修复目前效果更好。

注意:这是一个已知问题,这里有一些关于如何解决该问题的建议 - CSS3 属性 webkit-overflow-scrolling:touch ERROR

The problem seems to be this line of CSS in jquery.mobile.splitview.css (line:75)

-webkit-overflow-scrolling:touch;

If you comment it out the scrolling bug(s) go away but the ul element has no momentum whatsoever.

It seems to be an iOS5 specific rule to enable native momentum scrolling. See http://johanbrook.com/browsers/native-momentum-scrolling-ios-5/

CSS Fix

So that the page scrolls with momentum

#search .ui-content {
 -webkit-transform: translate3d(0, 0, 0);
}

#search-list {
 position:  static;
 overflow:  scroll;
}

Where #search is the page-id and #search list is the ul element. However now it seems as if swipe left and right have become swipe up and down respectively. Weird.

JS Fix (recommended)

On line 527 if jquery.mobile.splitview.js make the change below

//if ($.support.touch && !$.support.touchOverflow) {
if($.support.touch){

This forces the fallback code for using iScroll.js to run.

I think the JS fix works better for now.

NB: This is a known issue and there are some suggestions on how to work around it here - CSS3 property webkit-overflow-scrolling:touch ERROR

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文