- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我将 jquery mobile 1.0 与 swipejs 结合使用。 swipejs库用于允许在图像轮播上进行移动滑动手势。但是,我在 Android 2.2.3 (Motorola Droid) 和其他 Android 设备上遇到了一个问题,其中选择列表(与 swipejs 在同一页面上)根本不起作用。选择列表出现,但 native 选项菜单不会弹出,单击它们根本无济于事。我不仅能够将其缩小到 swipejs,而且还能缩小到 swipejs 中的特定行。
style.webkitTransform = 'translate3d(' + -(index * this.width) + 'px,0,0)';
transalate3d css 行为似乎以某种方式干扰了 jquery 移动选择列表。我发现了很多关于 Android 上 jquery 移动选择列表脆弱性的报告 (https://github.com/jquery/jquery-mobile/issues/1051)。并且已经能够创建一个相当简单的示例页面来展示这种行为。我的解决方法是更改 translate3d 以在 swipejs 库本身中进行翻译。但我想知道是否有人更好地了解 translate3d 的作用以及它可能如何影响 jquery mobile 可能会提出更好的解决方案,或者这是 jqm 或 swipejs 的错误?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-icon" href="/images/mobile/homeIcon.png" />
<link rel="apple-touch-startup-image" href="/images/mobile/splash.png" />
<link href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" rel="Stylesheet" type="text/css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).bind("mobileinit", function () {
$.mobile.ajaxEnabled = false;
});
</script>
<script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js" type="text/javascript"></script>
</head>
<body>
<div data-role="page" id="main">
<header data-role="header">
</header>
<div data-role="content">
<div data-role="fieldcontain">
<label for="select-choice-1">
Shipping method:</label>
<select name="select-choice-0" id="select-choice-1" data-theme="a">
<option value="standard">Standard: 7 day</option>
<option value="rush">Rush: 3 days</option>
<option value="express">Express: next day</option>
<option value="overnight">Overnight</option>
</select>
</div>
<div id="divProductImagesCarousel">
<ul>
<li><a href="image_0.jpg">
<img width="250" height="250" src="image_0.jpg" alt="Product Image" style="margin-right: 50px;" />
</a></li>
<li><a href="image_1.jpg">
<img width="250" height="250" src="image_1.jpg" alt="Product Image" style="margin-right: 50px;" />
</a></li>
<li><a href="image_2.jpg">
<img width="250" height="250" src="image_2.jpg" alt="Product Image" style="margin-right: 50px;" />
</a></li>
<li><a href="image_3.jpg">
<img width="250" height="250" src="image_3.jpg" alt="Product Image" style="margin-right: 50px;" />
</a></li>
<li><a href="image_4.jpg">
<img width="250" height="250" src="image_4.jpg" alt="Product Image" style="margin-right: 50px;" />
</a></li>
<li><a href="image_5.jpg">
<img width="250" height="250" src="image_5.jpg" alt="Product Image" style="margin-right: 50px;" />
</a></li>
<li><a href="image_6.jpg">
<img width="250" height="250" src="image_6.jpg" alt="Product Image" style="margin-right: 50px;" />
</a></li>
<li><a href="image_7.jpg">
<img width="250" height="250" src="image_7.jpg" alt="Product Image" style="margin-right: 50px;" />
</a></li>
<li><a href="image_8.jpg">
<img width="250" height="250" src="image_8.jpg" alt="Product Image" style="margin-right: 50px;" />
</a></li>
<li><a href="image_9.jpg">
<img width="250" height="250" src="image_9.jpg" alt="Product Image" style="margin-right: 50px;" />
</a></li>
</ul>
</div>
</div>
</div>
<script src="https://raw.github.com/bradbirdsall/Swipe/master/swipe.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
var productImagesCarousel = document.getElementById('divProductImagesCarousel');
window.mySwipe = new Swipe(productImagesCarousel);
});
</script>
</body>
</html>
最佳答案
是的,jQueryMobile有自己的滑动功能
但是! swipeJS 太棒了!而且您仍然可以使用它!
这让我进行了大量调查,但我找到了适合我的解决方案。
基本上,只需将所有 swipejs 内容放入 $(document).ready(function(){
像这样:
<script type="text/javascript">
// outside ready function so that buttons still have a var to attach function calls to like slider.next()
var slider;
// process AFTER jquery mobile.
// i "think" the problem that somehow jquery mobile stops swipejs from detecting the width of the div (in the setup function)
$(document).ready(function(){
slider = new Swipe(document.getElementById('myslider'), {
callback: function(e, pos) {
// some callback code here
}
});
});
</script>
我认为这不是 JS 中的冲突——也许吧。这会强制在最后处理 swipejs,并且大概是在任何 jquerymobile 功能搞砸之后。
我是 JS 的新手,所以我不知道这个函数与其他“最后执行”类型的函数有何不同。我想这可能会导致其他讨厌的冲突。如果有人想用更好的功能(以及为什么)发表评论,那也很好。
关于android - Jquery Mobile 和 Swipe JS 不兼容导致选择列表无法在 Android 上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9383077/
我有一个为 Firefox 3.6 编写的附加组件,现在我正在将其升级到 Firefox 4.0,同时尝试使其与 3.6 兼容。有没有人有尝试这样做的经验,或者关于如何在代码变得太意大利面条式的情况下
我已经安装了 Cassandra 2.0.1 并想在我的应用程序中使用 Astyanax Java API。我在维基上看到了 Cassandra 兼容性表,上面写着 Astyanax 使用 Netfl
是否可以使纯粹在 VBScript(无 COM 对象)中实现的自定义容器类与 For Each 语句一起使用?如果是这样,我必须公开哪些方法? 最佳答案 简而言之,没有 为什么?创建一个可枚举的集合类
我这里的代码很少 int b=3; b=b >> 1; System.out.println(b); 它工作得很好,但是当我将变量 b 更改为 byte、short、float、double 时它包含
我们有一个 Java 客户端,它使用 corba 调用多个第三方系统。这些是实现同一组接口(interface)的不同系统。我们获得了使用这些接口(interface)的库(jar 文件)。例如,这些
我知道从技术上讲 HTML5 是一个“实时规范”,但我想知道它是否符合在类名中添加尾随空格的规定。我没有在规范中看到任何对这种情况的引用,但我的一个队友说它是无效的。也许我错过了什么? 修剪这些空间会
我在 Linux x86-64 上用 C 语言编程。我正在使用一个库,它通过原始 clone 创建多个线程系统调用而不是使用 pthread_create .这些线程运行库内部的低级代码。 我想钩住这
我希望用汇编程序编写一个可启动程序,能够发送和接收网络数据包。我不想使用任何库,我想自己创建它(并在这样做的同时学习)。不幸的是,我无法找到有关最低级别的网卡通信(发送原始套接字)的任何信息。我相信有
是否有除 fixed scoping 之外没有任何更改的 CoffeeScript 分支,以便它在很大程度上与 CoffeeScript 兼容(如果代码没有外部变量赋值则完全兼容)?我会考虑使用可接受
这个问题已经有答案了: Why is BiConsumer allowed to be assigned with a function that only accepts a single para
我的 Java 应用程序需要一个高性能主内存数据库 1] 请建议数据库 -符合 JDBC -独立(即平面文件) -支持内存表 -高性能 -B-TREE索引 2] JAVA中是否有任何技术可以在程序运行
我通常会找到一些以char*作为参数的函数,但是我听说在C++中更推荐std::string。如何将std::string对象与以char* s为参数的函数一起使用?到目前为止,我已经知道了c_str
我正在移植我的一个旧 javascript 文件以与 requireJS 兼容。这是以前代码的样子。 // effect.js (function(exports){ // shorthand
在今天更新我的 SDK 之前,我有工作代码(为了将来引用,请查看问题询问日期)。 .getMap 曾经发出警告,表明它已被弃用,但现在它甚至不被识别为有效输入。我假设这是因为 API 24(Andro
根据 this reference sheet on hyperpolyglot.org , 下面的语法可以用来设置一个数组。 i=(1 2 3) 但是我在 dash 上遇到错误,它是 Ubuntu
我的 MacBook 上安装了 MYSQL 8.0.12(下载版本)。当我尝试转储 mysql40 的兼容版本时,收到错误 Invalid mode to --known: mysql40。我 100
您好,我正在更改我的版本控制系统,我调查了 perforce 是否与 bcm 补救措施兼容。有谁知道其他版本的控制系统也与 bcm 补救措施兼容?? 最佳答案 BMC Remedy 会更接近 Clea
我需要在 python 中的图像上绘制一般坐标网格。我可以计算网格线的像素坐标,因此我只需要一个能够将它们绘制为图像顶部的虚线 的模块。图像以 numpy 数组的形式出现,因此我需要能够在这些格式和绘
库接受文件输入的“传统”方式是做这样的事情: def foo(file_obj): data = file_obj.read() # Do other things here 客户端代
代码 Untitled Document #topDropDownMenu { position: relative;
我是一名优秀的程序员,十分优秀!