Support » Plugin: Instagram Feed » Mobile View No. of columns

  • Hi there,

    Awesome plugin!

    I’m trying to change the mobile view to 2 columns for 6 images and have tried the code…

    @media(max-width: 600px){
    #sb_instagram #sbi_images .sbi_item{ display: none; }
    #sb_instagram #sbi_images .sbi_item:nth-child(-n+6){ display: inline-block; }
    #sb_instagram #sbi_images .sbi_item { width: 50% !important; }
    }

    However this reduces the individual picture widths (by 50%) to display 2 columns but does not change the individual Instagram picture heights which remains at full size. Therefore I have half width, tall Instagram pictures.

    Is there a way to simply have mobile view as 2 columns showing small, original format pictures?

    Thanks very much,

    Sam

    https://wordpress.org/plugins/instagram-feed/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Craig at Smash Balloon

    (@craig-at-smash-balloon)

    Hey Sam,

    You can use some custom javascript to recalculate the height of the images to match the width. Go to the Settings page, “Customize” tab, and scroll down to the “Custom Javascript” area. Paste in this code:

    jQuery(window).resize(function(){
      jQuery('#sb_instagram .sbi_photo').css('height', jQuery('#sb_instagram .sbi_photo').eq(0).innerWidth() );
    });
    jQuery('#sb_instagram .sbi_photo').css('height', jQuery('#sb_instagram .sbi_photo').eq(0).innerWidth() );

    Let me know if you have any questions about this. I hope you are having a great day!

    Hey Craig!

    Thanks for the fast response! That works, for a split moment and then the images revert back to the original height. On scroll it triggers again, they shrink to the correct aspect, but then jump back up to full height again. It’s kinda crazy!

    Any ideas? It doesn’t seem to do it when the image size is set to thumbnail. Is there a way to force thumbnail version for mobile only?

    Thanks very much,

    Sam

    Plugin Contributor Craig at Smash Balloon

    (@craig-at-smash-balloon)

    Hey Sam,

    Hmm that is crazy! I wonder if adding a delay will fix your problem. Try this instead:

    jQuery(window).resize(function(){
    setTimeout(function(){
      jQuery('#sb_instagram .sbi_photo').css('height', jQuery('#sb_instagram .sbi_photo').eq(0).innerWidth() );
    }, 500);
    });
    setTimeout(function(){
    jQuery('#sb_instagram .sbi_photo').css('height', jQuery('#sb_instagram .sbi_photo').eq(0).innerWidth() );
    }, 500);

    If you still have the same problem, could you send me a link to take a look first hand? If you don’t want to give out a link on the forum, you can contact us from our support form: https://smashballoon.com/instagram-feed/support/

    Hey Craig!

    That works perfectly! Thanks very much for your help. 5* review on the way and most likely another paid plugin member!

    Really appreciate your time and your help 😀

    Sam

    Plugin Contributor Craig at Smash Balloon

    (@craig-at-smash-balloon)

    Hey Sam,

    Glad that fixed the issue! We appreciate the review as well that really helps us out. We would love to have you as a customer for our premium version so thanks for your interest in that too. Let me know if you need any assistance setting it up.

    Many thanks,

    Craig

    this works but flashes the wrong proportion for split second. is there a way to get rid of that?

    Plugin Contributor Craig at Smash Balloon

    (@craig-at-smash-balloon)

    Hey tounsoo,

    Some themes will not need the delay in this code or might not need a full 500 milliseconds:

    jQuery(window).resize(function(){
    setTimeout(function(){
      jQuery('#sb_instagram .sbi_photo').css('height', jQuery('#sb_instagram .sbi_photo').eq(0).innerWidth() );
    }, 500);
    });
    setTimeout(function(){
    jQuery('#sb_instagram .sbi_photo').css('height', jQuery('#sb_instagram .sbi_photo').eq(0).innerWidth() );
    }, 500);

    You can try adjusting the “500” number to be lower or you can remove that part of the code completely since it will likely still work like this:

    jQuery(window).resize(function(){
      jQuery('#sb_instagram .sbi_photo').css('height', jQuery('#sb_instagram .sbi_photo').eq(0).innerWidth() );
    });
    jQuery('#sb_instagram .sbi_photo').css('height', jQuery('#sb_instagram .sbi_photo').eq(0).innerWidth() );

    Let me know if you are still having trouble and I can take a look at the page you are having trouble with.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Mobile View No. of columns’ is closed to new replies.