Tiggles ツ
10/26/2017 - 2:01 PM

[Responsive Banner Rotator] This will take ur fixed height banner rotator, and adjust to viewport width to keep 100% width #javascript #site

[Responsive Banner Rotator] This will take ur fixed height banner rotator, and adjust to viewport width to keep 100% width #javascript #sitewrench

/* JS -- Responsive Banner Rotator -- */

(function($){
	 var jQuery = $;

	 function sliderHeight(e) {
		var sh = (e != null && e.target != null && e.target.nodeName === 'IMG' ?
			$(e.target) :
			$('.item img:visible')
		).height();
		$('#top-wrapper').css({'height': sh +'px'});
		$('#top-wrapper .scrollable').css({'height': sh +'px'});
	}

	$(document).ready(function() {
		$(".item img").eq(0).one("load", sliderHeight).each(function() {
			if(this.complete) $(this).load();
		});
	});

	$(window).on('resize', sliderHeight);

	// duplicate caption and move below slider for mobile purposes
	// $('.item .caption').clone().addClass('mobile-caption').insertAfter('.home-slider');

})(jQ171);