jQuery .show() 和 BlackBerry OS5

发布于 2024-11-24 02:56:03 字数 347 浏览 1 评论 0原文

这可能是一个不太可能的事情,但是...

有人在 BlackBerry OS5 Web 浏览器中使用 jQuery 的 show() 时遇到问题并导致其无法工作(在设备上)或使手机崩溃(模拟器)吗?如果可行,找到解决方法了吗?

无论我们使用 .show() 还是 .css('display','block') 都会发生同样的事情。

在 OS6、iOS、Firefox、Chrome 等中工作,但在 OS5 浏览器中消失。

哦,我应该补充一点:

据我们所知,这只是在运行我们的实际服务器(JSF、websphere)的应用程序时出现的问题。当我们在本地测试 jQuery 作为静态页面时,它工作得很好。

This is probably a long shot, but...

Anyone run into a problem using jQuery's show() in a BlackBerry OS5 web browser and causing it to either not work (on the device) or crash the phone (simulator)? If sound, found a workaround?

The same thing happens whether we use .show() or .css('display','block')

Works in OS6, iOS, Firefox, Chrome, etc, etc...but dies in the OS5 browser.

Oh, I should add:

From what we can tell, this is only an issue when running our application of our actual servers (JSF, websphere). When we test the jQuery locally as a static page, it works fine.

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

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

发布评论

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

评论(2

鹿! 2024-12-01 02:56:03

我的团队也在使用 jQuery Mobile,并在设备上遇到了类似的问题(尽管我认为我们还没有看到模拟器因此崩溃)。以下是我们迄今为止发现的内容:

  • 您对 show() 的调用可能有效,但处理速度太慢,以至于您在加载之前就放弃了。 每次添加、删除或修改任何内容时都会处理网页的整个 DOM页面上的属性或元素。 BlackBerry 论坛帖子建议 在修改元素之前删除元素以提高性能。

  • 在某些设备上,我们发现对 show() 的调用可以工作,但只有在页面上向上或向下滚动一点后,UI 才会更新。如果您的页面太短而无法滚动,那么您可能会运气不佳。

  • onclick 属性在触摸屏上似乎被忽略(但在轨迹球/触摸板设备上工作正常),这可能就是为什么您的 show() 调用结果不行动。为了使我们的超链接适用于所有设备,我们在 onclickhref 属性中放置 JavaScript 调用:
    Show

  • onclick 方法调用 JavaScript 时,我们必须在方法调用前加上 <代码>javascript:像这样:
    显示
    (大多数现代浏览器假定您的 onclick 值应被计算为 JavaScript)

  • 默认情况下不启用基于焦点的导航,这给我们在使用轨迹球/拇指板设备时带来了问题(屏幕会锁定)并停止响应按键)。您可以在项目的 config.xml 中启用基于焦点的导航 或使用 RIM 特定的超链接属性。我忘记了在 config.xml 中启用此功能后遇到的问题,但我们最终使用了 x-blackberry-initialFocus 超链接属性。

很难确切地说上述哪一点可能适用于您的情况,希望某些内容相关或有用。到目前为止,我的团队对 BlackBerry 上的 Web 开发体验并不满意,特别是 OS 5 和 6 之间以及轨迹球/拇指板和触摸设备之间的差异。

My team at work is also using jQuery Mobile and encountered similar problems on devices (though I don't think we've seen a simulator crash from this). Here's what we've found so far:

  • Your call to show() may be working, but be processed so slowly that you give up before it loads. The entire DOM for the web page is processed every time you add, remove, or modify any attribute or element on the page. A BlackBerry Forums post suggests removing an element before modifying it to increase performance.

  • On some devices we've found that a call to show() will work, but the UI is only updated after scrolling up or down on the page a bit. If your page is too short to scroll, you might be out of luck.

  • The onclick attribute appears to be ignored on touch screens (but works fine on trackball/touchpad devices), and may be why your show() call results in no action. To make our hyperlinks work on all devices, we place JavaScript calls in both the onclick and href attributes:
    <a href="javascript:showThings();" onclick="javascript:showThings();">Show</a>

  • When invoking JavaScript from an onclick method, we've had to prepend the method call with javascript: like so:
    <a href="#" onclick="javascript:showThings();">Show</a>
    (Most modern browsers assume that your onclick value should be evaluated as JavaScript)

  • Focus-based navigation is not enabled by default, which caused us problems when using trackball/thumbpad devices (the screen would lock up and stop responding to key presses). You can enable focus-based navigation in either your project's config.xml or by using a RIM-specific hyperlink attribute. I forget what issue we encountered after enabling this in config.xml, but we ended up going with the x-blackberry-initialFocus hyperlink attribute instead.

It's hard to say exactly which of the above points might apply to your situation, hopefully something is relevant or useful. My team has been unimpressed so far with the web development experience on BlackBerry, particularly the differences seen between OS 5 and 6, and between trackball/thumbpad and touch devices.

怎会甘心 2024-12-01 02:56:03

我们发现的问题是,OS5 的浏览器在将显示属性从 BLOCK 更改为 NONE 时更新 DOM 时出现问题。一位 BlackBerry 代表甚至告诉我们,应该避免更新 OS5 中的 DOM(呃!)。

因此,我们最终采用的解决方案是不使用 .show().hide() ,而是切换类名。除 OS5 之外的每个设备都会使用类名切换显示属性,但是 OS5 会将高度从 auto 切换到 0px

这让 OS5 很高兴。

尽管如此,这仍然不能解释一些变量......例如我们可以在本地作为静态页面运行代码并在模拟器中运行它就可以了。但是,如果我们尝试从服务器加载页面,完全相同的代码将会崩溃。

我们还可以在应用程序的其他地方使用 .show() ,没有问题。

最后,我相信,如果某些子元素的 display 被切换,则应用到父元素的 CSS 的某些特定组合会杀死浏览器。

The issue we found is that OS5's browser just has issues updating the DOM when changing display properties from BLOCK to NONE. A BlackBerry rep has even told us that one should just avoid updating the DOM in OS5 (ugh!).

So, the solution we ended up going with was to not use .show() and .hide() but rather we toggled a class name. Every device except OS5 would have the class name toggle the display property, OS5, however, would toggle the height from auto to 0px

This made OS5 happy.

All that said, that still doesn't explain some of the variables...such as that we could run the code locally as a static page and run it in the simulator just fine. But the exact same code would crash if we tried loading the page off of our server.

We can also use .show() elsewhere in the app without a problem.

In the end, I believe it's some particular combination of CSS applied to parent elements that kills the browser if some of its child elements are having their display toggled.

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