(function ($) { // Behavior to load FlexSlider Drupal.behaviors.flexslider = { attach: function(context, settings) { $('.flexslider', context).once('flexslider', function() { $(this).each(function() { var $this = $(this); var id = $this.attr('id'); if (settings.flexslider !== undefined) { var optionset = settings.flexslider.instances[id]; if (optionset) { $this.flexslider(settings.flexslider.optionsets[optionset]); } else { $this.flexslider(); } } }); // Remove width/height attributes $(this).find('ul.slides li img').removeAttr('height'); $(this).find('ul.slides li img').removeAttr('width'); }); } }; }(jQuery));