Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save monecchi/363604e0e14f7f02dc9e27eff457b68a to your computer and use it in GitHub Desktop.
Save monecchi/363604e0e14f7f02dc9e27eff457b68a to your computer and use it in GitHub Desktop.
Helper js function for responsive jQuery Spectragram plugin
/**
* Helper function for responsive jQuery Spectragram
* @require - jquery-spectragram.js plugin - https://github.com/adrianengine/jquery-spectragram
*/
// Target the spectragram's wrapper as per the plugin's docs:
var insta = jQuery('#instagram_feed');
// Check for the wrapper's presence in the DOM
if (insta.length) {
!function(a){jQuery.fn.responsiveInstagram=function(b){var c,d,e,f=a(this),g=a(window).width();return e={width:610,extraHeight:80,breakpoint:620},b=a.extend(e,b),g<=b.breakpoint?f.css("width","100%"):f.css("width",b.width.toString(10)+"px"),c=f.width(),d=Math.round(c+b.extraHeight),f.css("height",d.toString(10)+"px"),this}}(jQuery);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment