• Hello,

    thanks for the great plugin. I discovered some issues and tried to fix them.

    I think $(this).load(); in js/input.js is deprecated and should be $(this).trigger( 'load' );.

    The next issue was, that the canvas did not draw, if the field was inside an closed ACF accordion field. I found the same issue while switching tabs. I solved this using by using the ACF JS-API action ‘show_field’ to draw the canvas again. But this solution is drawing each focal field multiple time, so I hope, you may get a better solution.

    Fore a real responsive behavior (cover/ not contain) I stripped out some code parts in focal-point.js:

    /*if ( fwidth/oheight > twidth/theight ) {
        height = oheight*twidth/fwidth;
        width = owidth*twidth/fwidth;
        left = -fx1*width;
        top = (theight-height)/2;
    } else {*/
    // leave the code
    /* } */
    /*if ( fheight/owidth > theight/twidth ) {
        width = owidth*theight/fheight;
        height = oheight*theight/fheight;
        top = -fy1*height;
        left = (twidth-width)/2;
     } else {*/
    // leave the code
    /* } */

    I also extended the usecase for background images which would be awesome to have in this plugin.

    Thanks a lot for your work!
    Johann

Viewing 1 replies (of 1 total)
  • Thread Starter Johann Heyne

    (@jonua)

    Hi,

    there is an race condition issue when placing the focal point image inside an element, that also uses the jQuery resize event. In my situation I used a focal point image inside a Slick slider. After resizing the window, the image sometimes was not correct positioned. To fix that, I changed the code in js/focal-point.js…

    var timeout;
    
    // When window is resizing...
    $(window).on( 'resize', function() {
    
        // Retrigger responsify.js
        $img.responsifyBackground();
    
        clearTimeout( timeout );
            timeout = setTimeout( function() {
    
            // Retrigger responsify.js once again after resize ends
            $img.responsifyBackground();
    
        }, 250 );
    });

    Cheers,
    Johann

    • This reply was modified 5 years, 10 months ago by Johann Heyne.
Viewing 1 replies (of 1 total)
  • The topic ‘Fixes and Feature requests’ is closed to new replies.