【发布时间】:2013-09-01 05:43:33
【问题描述】:
所以我有一个带有单选按钮的 CSS3 幻灯片设置来触发下一张幻灯片。我希望能够为平板电脑和手机添加触摸/滑动(即向左滑动,然后检查下一个收音机)。
我正在尝试使用的 jQuery:
$(document).ready(function() {
$("#cover").swipeleft(function(event){
$('input:radio[class=slide_2]').attr("checked", true);
});
$("#cover2").swiperight(function(event){
$('input:radio[class=slide_1]').attr("checked", true);
});
$("#cover2").swipeleft(function(event){
$('input:radio[class=slide_3]').attr("checked", true);
});
$("#ingredients").swiperight(function(event){
$('input:radio[class=slide_2]').attr("checked", true);
});
$("#ingredients").swipeleft(function(event){
$('input:radio[class=slide_4]').attr("checked", true);
});
$("#directions").swiperight(function(event){
$('input:radio[class=slide_3]').attr("checked", true);
});
});
http://jsfiddle.net/hakarune/ZsrdP/1/ 这是整个设置和我的 jQuery,但它根本不起作用。有人知道如何解决吗?
【问题讨论】:
-
新的更新,G+ 上的 Blaise Rienzo 能够制作出有效的 fiddle。他包括了 jQueryMobile,在 CSS 中添加了
section{height: 100%},将.attr更改为.prop... 我对其进行了更改,因此滑动从幻灯片 div 上移开,它在小提琴中起作用。但是一旦我将它设置为实际页面,它就不再起作用了DEMO 有什么问题吗? -
有错误返回,因为它不是 https 服务,在站点上尝试了 https 和本地,添加
jquery.mobile-1.3.2.min.js似乎导致页面变为空白,但不会产生错误.... -
当我通过 https 主机将其更改为
jquery.mobile-1.2.0.min.js时,它就与jquery.mobile-1.3.2.min.js有关。
标签: javascript jquery html swipe touchscreen