我正在创建一个基于 webview 的 android 应用程序,在该应用程序中我需要像电子书页面一样显示 html,我必须使用 webview 的原因是因为我需要在滚动标题更改时根据内容查看此链接更改标题 http:// jsfiddle.net/kd6Y4/10/show/ 我如何对其进行分页请帮助我这里的代码是 jsfiddle 链接http://jsfiddle.net/kd6Y4/10/ js 代码用于阅读标题并向电子书添加突出显示:-
$(window).scroll(function() {
var winTop = $(this).scrollTop();
var divs = $("div");
var top = $.grep(divs, function(item) {
return $(item).position().top <= winTop;
});
//var id=$(top).first().attr('id');
var ll = $(top);
$(top).each(function(i, item) {
var total = ll.length - 1;
if (total == i) {
$("#finalvalue1").empty();
document.title = $(item).attr("id");
}
});
});
function createListener1() {
document.addEventListener(
"click",
function(event) {
var element = event.target;
if (element !== document.body) {
if (element.className === "vs") {
element.className = "highlight1";
} else if (element.className === "highlight1") {
element.className = "vs";
}
}
},
false
);
}
function createListener2() {
document.addEventListener(
"click",
function(event) {
var element = event.target;
if (element !== document.body) {
if (element.className === "vs") {
element.className = "highlight2";
} else if (element.className === "highlight2") {
element.className = "vs";
}
}
},
false
);
}
function createListener3() {
document.addEventListener(
"click",
function(event) {
var element = event.target;
if (element !== document.body) {
if (element.className === "vs") {
element.className = "highlight3";
} else if (element.className === "highlight3") {
element.className = "vs";
}
}
},
false
);
}