我在移动网站上使用 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 不是函数源文件:文件:/js/zepto.min.js 行:1