I am developing an epub ebook application, i am able to unzip and parse the epub and dispaly the TOC, text in a UIWebview with pagination.
I am able to search the particular string also and able to highlight the string also, but i am unable to开发者_如何学运维 navigate to that paricular page(where acutal string found and highlighted string page).
Could any one please guide me how we can I navigate to particular page where the actual found string is there?
Thanks in advance.
Shiva.
You can find your requirement here
https://github.com/fedefrappi/AePubReader
I got the solution for it, if any one required please refer to below code.
function getElementFromPoint(x,y)
{
var str ="hello";
var i = 0;
var j = 20;
var x1 = parseInt(x)+j;
alert("x"+x1);
for( i = 0 ;i < 1024;i += 2)
{
var element = document.elementFromPoint(x1,i);
if(element.nodeName == "p" || element.nodeName == "h1" || element.nodeName == "h2" || element.nodeName == "h3")
{
str = element.innerText.trim();
if(str.length <= 3)
continue; return str;
}
}
return str;
}
getElementFromPoint(x,y);
精彩评论