私はアンドロイド epub 2 リーダーを開発しています。私のリーダーは、スライドショー以外は常に 5 ページを超えてスムーズに動作しています。それは728px(私のWebビューの幅)で分割されていたので、画像のすべての高さを合計する条件を形成し、それをepubの全長から差し引いて728pxに分割しましたが、答えは表示するには不十分です.正確なページ。12ページではなく11ページしか表示されませんでした..
ここにJavascriptの私のコードがあります:
function calculateOffset(firstLoad){
var offset = 0;
var pos = $('#' + pageEndMarker).position();
var slideshowImageHeight = 0;
var listLength = 0;
var slideshowExist = false;
if(document.getElementById("slideshow")){
slideshowExist = true;
var images, list;
var ImageHeight = 0;
slideshowExist = true;
//This code is for getting all the ul elements with "slideshow" id
//and total all the length of all the li element;
images = document.getElementById("slideshow");
list = images.getElementsByTagName('li');
// the answer is 15 becaused it has 15 list of images
listLength = list.length;
//this code is to compute the total height of the images.
//I did subtract 1 on the listLength,because i will subtract the listLength with the value of 14 elements on the total epub length. so that only one image size will add to the total epub length and that will serve as the height of the entire slideshow.
for(var i = 0; i < listLength-1; i++) {
imgHeight += $("li").height();
slideshowImageHeight = imgHeight;//the answer is 11648
}
}
if(pos!=null){
var excessWidth = pos.left % desiredWidth;
if(excessWidth > desiredWidth / 2) {
offset = (pos.left + desiredWidth) - excessWidth;
} else {
offset = pos.left - excessWidth;
//this code is to subtract the total slideshowImageHeight
if(slideshowExist){
//the offset should have a value of 8008 instead of 7878 to be come 12pages in android code
offset = offset - slideshowImageHeight;//11648 - 3780 = 7868
}
}
}
これがAndroidでの私のコードです:
public void setOffset(int offsetWidth) {
if (VibeGlobalData.mVibeReaderActivity != null) {
VibeGlobalData.mVibeReaderActivity.getWebView().setOffsetWidth(
offsetWidth);
int width = getWidth();
if (width > 0) {
//this code divides the total offset from javascript
int pageSize = offsetWidth / width; // 7868 / 728 = 10.8076
VibeGlobalData.mVibeBook.setCurrentPageSize(pageSize);//this code has a class that will get the total pageSize = 10.8076 then rounded to 10 then adds 1 = 11 pages;
}
VibeGlobalData.mVibeReaderActivity.sendHandlerMsg(
VibeReaderActivity.GUIHandler.MSG_OFFSET_CHANGED, null);
}
}
これが私の epub 2 のコードです: しかし、これはすでに幅 = 462px & 高さ = 270px にサイズ変更されています:
<!-- SLIDESHOW-->
<div class="slideshow-wrap">
<ul class="slideshow" id="slideshow">
<li ><img src="assets/images/she-epow1_p47_slide1.png" style="width: 700px;" /></li>
<li ><img src="assets/images/she-epow1_p47_slide2.png" style="width: 700px;" /></li>
<li ><img src="assets/images/she-epow1_p47_slide3.png" style="width: 700px;" /></li>
<li ><img src="assets/images/she-epow1_p47_slide4.png" style="width: 700px;" /></li>
<li ><img src="assets/images/she-epow1_p47_slide5.png" style="width: 700px;" /></li>
<li ><img src="assets/images/she-epow1_p47_slide6.png" style="width: 700px;" /></li>
<li ><img src="assets/images/she-epow1_p47_slide7.png" style="width: 700px;" /></li>
<li ><img src="assets/images/she-epow1_p47_slide8.png" style="width: 700px;" /></li>
<li ><img src="assets/images/she-epow1_p47_slide9.png" style="width: 700px;" /></li>
<li ><img src="assets/images/she-epow1_p47_slide10.png" style="width: 700px;" /></li>
<li ><img src="assets/images/she-epow1_p47_slide11.png" style="width: 700px;" /></li>
<li ><img src="assets/images/she-epow1_p47_slide12.png" style="width: 700px;" /></li>
<li ><img src="assets/images/she-epow1_p47_slide13.png" style="width: 700px;" /></li>
<li ><img src="assets/images/she-epow1_p47_slide14.png" style="width: 700px;" /></li>
<li ><img src="assets/images/she-epow1_p47_slide15.png" style="width: 700px;" /></li>
</ul>
<nav class="slideshow-controls"> <a class="play">»</a> </nav>
</div>
私は他のepubリーダーを観察します.スライドショーではなく画像のリストのみを表示するリーダーもあれば、5つの余分なページがあり、スライドショーをまったく表示しないという同じ問題を抱えているリーダーもあります..epub 2でaを表示することは可能ですか?バグのないスライドショー?