开发者

searching and highlighting a string in epub book in iphone or ipad

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜