Docs    Instagram    Customizations

Display the Instagram Feed in a Carousel layout only on mobile devices

In the Pro version of the plugin it is possible to display a regular grid layout on desktop devices but then switch to a carousel layout on smaller/mobile devices.

1) First, enable the “Carousel” setting for the feed, either on the plugin’s “Customize” page or by using carousel=true in the shortcode.

2) Then try adding the following to your theme’s functions.php file.:

function sb_custom_carousel_grid() {
	?>
	<script>
        jQuery(window).on('sbiafterlayoutinit', function (event) {
            if (jQuery(window).width() > 480) {
                event.feed.layout = 'grid';
                jQuery('.sbi_carousel').removeClass('sbi_carousel');
            }
        });
	</script>
	<?php
}
add_action( 'wp_footer', 'sb_custom_carousel_grid');

By default, the Carousel will be used on the feed, but when it’s above 480 pixels then the snippet removes the carousel and restores the regular layout.

Technical Support

Still have questions? We are here to help you succeed.

Open a support ticket