現在、サイズ変更機能に取り組んでいます。クロムでは完全に機能しますが、ffやサファリでは機能しません。(ブックの位置が通常より右と下に移動します) それらのブラウザでサポートされていない機能はありますか? 見てください、ありがとう。
Resize 時に呼び出される関数:
$(window).resize(function() {
if (!isiPhone()) {
Book.book_position();
Book.zoom_auto();
//Book.dragdrop_init();
}
//calculate_zoom_factor();
});
book_position()
book_position: function() {
book_height = $('#page').height();
book_width = $('#page').width();
half_height = (book_height/2)+30;
half_width = book_width/2;
$('#page').css({ left: '50%', top: '50%', margin: '-'+half_height+'px auto 0 -'+half_width+'px' });
},
zoom_auto()
zoom_auto: function() {
dbl_clicked = false;
current_zoom_step = 0;
//calculate_zoom_factor(true);
screen_height = $(window).height();
book_width = $('#book').width();
screen_width = $(window).width()-100;
book_height = $('#book').height();
if (isiPhone()) {
var new_height = screen_height - 100;
var ratio = new_height / book_height;
var new_width = book_width * ratio;
$('#page').css({ width: new_width, height: new_height });
$('#book').turn('size', new_width, new_height);
} else {
Book.scaleStart();
current_window_width = $(window).width();
current_window_height = $(window).height();
if (current_window_width != window_width) {
if( $('#page').height() < ($(window).height() - 96) ) {
Book.scaleVertical();
}
if( $('#page').width() > ($(window).width() - 100) ) {
Book.scaleHorizontal();
}
}
if (current_window_height != window_height) {
if( $('#page').width() < ($(window).width() - 100) ) {
Book.scaleVertical();
}
if( $('#page').height() > ($(window).height() - 96) ) {
Book.scaleVertical();
}
}
deltaW= $('#page').width()-current_window_width;
deltaH= $('#page').height()-current_window_height;
if(deltaW>deltaH){
Book.scaleHorizontal();
}else{
Book.scaleVertical();
}
if (( $(window).width() > default_book_width ) && ( $(window).height() > (default_book_height+100) )) {
$('#page').css({ width: default_page_width, height: default_page_height });
$('#book').turn('size',default_book_width,default_book_height);
}
}
},
scaleVertical (zoom_auto で呼び出される)
scaleVertical: function() {
new_height = $(window).height() - 116;
ratio = new_height / $('#page').height();
new_width = $('#page').width() * ratio;
$('#page').css({ width: new_width, height: new_height });
$('#book').turn('size', new_width, new_height);
},
scaleHorizonal (zoom_auto で呼び出される)
scaleHorizontal: function() {
new_width = $(window).width()-100;
ratio = new_width / $('#page').width();
new_height = $('#page').height() * ratio;
$('#page').css({ width: new_width, height: new_height });
$('#book').turn('size', new_width, new_height);
},