【发布时间】:2012-04-16 04:40:59
【问题描述】:
我在移动网站上使用 zepto (http://zeptojs.com/)(我习惯在桌面环境中使用 jQuery)。
我有以下代码(稍作调整以便在桌面上运行)
(function($) {
// only do this if not on a touch device
if (!('ontouchend' in window)) {
$(document).delegate('.filter h2', 'click', function(e) {
$('.filter div').toggle();
e.preventDefault();
});
}
})(window.Zepto);
但是切换不起作用。如果我用标准 alert('hello world'); 替换该行,它就会被拾取(所以我知道正在调用 js)。
知道我错过了什么吗?
干杯, 广告。
编辑 我似乎收到了这个错误: 时间戳:02/04/2012 15:02:35 错误:h.body.insertAdjacentElement 不是函数 源文件:file:/js/zepto.min.js 行:1
【问题讨论】: