0

目前我正在研究调整大小功能,它在 chrome 上完美运行,但在 ff 或 safari 上都不能。(书的位置比正常的向右和底部移动) 那些浏览器有什么不支持的功能吗?请看一下,谢谢。

调整大小时调用函数:

$(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: 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);
},

scaleHoriztional(在 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);
},
4

0 回答 0