我无法使用我的选择框来启用桌面设备中的touchenabled。查看我的小提琴时,您会看到当您单击“文章”时,只有当我禁用桌面用户的touchenabled时,选择框才会起作用。
touchenabled:“on”http://jsfiddle.net/y82XD/(文章选择框不起作用)
touchenabled:“off”http://jsfiddle.net/y82XD/3/(文章选择框工作正常)
我正在使用脚本检测移动设备,并希望在检测到device.mobile时启用touchenabled:“on”。移动检测脚本有一个名为device.mobile()的JavaScript方法,可以使用。因此,使用以下脚本作为滑块,我将如何合并device.mobile()来设置touchenabled:“on”用于移动设备,同时设置touchenabled:“off”用于其他所有内容?
var tpj=jQuery;
tpj.noConflict();
tpj(document).ready(function() {
if (tpj.fn.cssOriginal!=undefined)
tpj.fn.css = tpj.fn.cssOriginal;
tpj('#slidebox').services(
{
width:620,
height:460,
slideAmount:4,
slideSpacing:10,
touchenabled:"off",
NEED CODE HERE to enable touchenabled:"on" when device.mobile detected
mouseWheel:"off",
hoverAlpha:"on",
slideshow:3500,
hovereffect:"on",
callBack:function() { }
});
});
答案 0 :(得分:0)
我可以通过更改幻灯片服务中的以下两个选项来启用选择框:
touchenabled:"off"
hoverAlpha:"off"
那些以前是。当我关闭它们时,父幻灯片div失去了它的mousedown和touchcancel事件监听器。
我对这个软件包知之甚少,无法理解这可能产生的影响。但它看起来正在做它之前所做的一切。
如果您需要启用这些选项,那么可能您可以在显示此特定页面时将其关闭?或者也许您可以在显示页面时解除导致问题的两个侦听器。
更新:
好的,在看完你的新评论之后,我不确定为什么这不会起作用,但看起来确实有点简单,所以也许我仍然不能100%理解它。 / p>
var touchEnabledValue = (device.mobile) ? "on" : "off;
tpj('#slidebox').services(
{
width:620,
height:460,
slideAmount:4,
slideSpacing:10,
touchenabled: touchEnabledValue,
mouseWheel:"off",
hoverAlpha: touchEnabledValue,
slideshow:3500,
hovereffect:"on",
callBack:function() { }
}