我正在尝试为iBooks eBook创建一个交互式词汇表:每次单击某个术语时,其定义都会显示在页面的末尾。您可以通过再次单击术语或单击其他术语来隐藏定义。在这种情况下,有两个术语。我用过jQuery,在Safari、Google Chrome和Mozilla Firefox上一切似乎都运行得很好。但是,它不能在桌面版的iBooks中正常工作(在iPad版的iBooks中确实可以正常工作),因为您只能打开定义一次,并且不能隐藏它们。
会出什么问题呢?
我使用的代码是:
$(document).ready(function () {
$('a').on('touchstart click', function (e) {
e.preventDefault();
$current = $($(this).attr('href'));
if ($current.hasClass('hide')) {
resetLabels();
$current.removeClass('hide').addClass('show');
} else if ($current.hasClass('show')) {
resetLabels();
$current.removeClass('show').addClass('hide');
} else {
resetLabels();
}
function resetLabels() {
$current.siblings().removeClass('show').addClass('hide');
}
});
});发布于 2014-08-06 18:10:11
$(document).bind('pageinit', function() {…});代替$(document).ready…https://stackoverflow.com/questions/25156070
复制相似问题