0

I was building a slideshow using bookblock plugin from Codrops, demo can be found here - BookBlock A Content Flip Plugin

In all browser it works, but in iPhone safari, the page gets reloaded each time I load the page. I have searched the web, and found it can be due to CSS transform property, but I have to use that as the slider depends on it.

The main issue seems to be a dynamic slide scaling function, which I have written to scale the slides to fit in any window (Actual slide dimension is 2048x1536px).

app.scaleSlide = function () {
    var scaleValue = 1,
        slideWidth = 2048,
        slideHeight = 1536,
        newSlideHeight = 0,
        newSlideWidth = 0,
        mainWrapperTopMargin = 0;

    // decide if viewport is in portrait mode or in landscape mode
    if(($winW >= $winH) && ($winW - $winH > 210)) {
        // calculate scale value
        scaleValue = parseFloat ($winH / slideHeight);
        console.log('landscape: '+scaleValue);

        // calculate new slide height & width
        newSlideHeight = $winH;
        newSlideWidth = parseFloat((slideWidth * newSlideHeight) / slideHeight);
        console.log('landscape H W: '+newSlideHeight+'/'+newSlideWidth);
    }
    else {
        // calculate scale value
        scaleValue = parseFloat ($winW / slideWidth);
        console.log('portrait: '+scaleValue);

        // calculate new slide height & width
        newSlideWidth = $winW;
        newSlideHeight = parseFloat((newSlideWidth * slideHeight) / slideWidth);
        console.log('portrait H W: '+newSlideHeight+'/'+newSlideWidth);

        // calculate top margin of main wrapper
        mainWrapperTopMargin = parseFloat(($winH - newSlideHeight) / 2);
    }


    // assign new slide height & width
    $('.slide-main-wrapper').css({
        width : newSlideWidth+'px',
        height : newSlideHeight+'px',
        marginTop : mainWrapperTopMargin+'px'
    });

    // add zoom to the slide
    $flipBookOuter.css({
        '-webkit-transform' : 'scale(' + scaleValue + ')',
        '-moz-transform'    : 'scale(' + scaleValue + ')',
        '-ms-transform'     : 'scale(' + scaleValue + ')',
        '-o-transform'      : 'scale(' + scaleValue + ')',
        'transform'         : 'scale(' + scaleValue + ')'
    });

    // remove loader
    /*$loader.animate({top: '100%'}, 800, function (e) {
        $(this).remove();
    });*/

    // activate flipbook
    app.flipBook.init();

    // start animation
    //app.startAnimation();

 }
halfer
  • 19,824
  • 17
  • 99
  • 186
abir_maiti
  • 490
  • 3
  • 9
  • 3
    `searched the web, and found it can be due to CSS transform property` please provide a link to support this claim. – Reactgular Aug 16 '18 at 13:27
  • Hey @cgTag here are the links - https://stackoverflow.com/questions/11831429/mobile-safari-on-ios-crashes-on-big-pages https://stackoverflow.com/questions/17824060/ios-safari-runs-out-of-memory-with-webkit-transform – abir_maiti Aug 17 '18 at 07:11
  • @abir_maiti did you fix the problem? I have the same with transform scale. – runia Dec 02 '21 at 11:20
  • @runia Had no luck :( what issue are you facing? – abir_maiti Dec 03 '21 at 12:12

0 Answers0