JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://flexslider.woothemes.com/js/jquery.flexslider.js"></script>
<link rel="stylesheet" href="http://woothemes.wpengine.netdna-cdn.com/wp-content/plugins/wooslider/assets/css/flexslider.css?ver=1.0.0">
<div class="flexslider">
<ul class="slides">
<li>
<figure>
<img src="http://lorempixel.com/400/200/animals/" alt="" />
<figcaption>
<h1>Lorem ipsum dolor sit amet</h1>
<p>consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco </p>
</figcaption>
</figure>
</li>
<li>
<figure>
<img src="http://lorempixel.com/400/200/sports/" alt="" />
<figcaption>
<h1>uis nostrud exercitation ullamco </h1>
<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco </p>
</figcaption>
</figure>
</li>
<li>
<figure>
<img src="http://lorempixel.com/400/200/people/" alt="" />
<figcaption>
<h1>ncididunt ut labore et dolore magna aliqua.</h1>
<p>abore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco </p>
</figcaption>
</figure>
</li>
</ul>
</div>
CSS
.flex-control-nav, .flex-control-paging {
clear: both;
}
.flexslider {
width: 100%;
}
.flexslider img {
min-width: 100%;
}
h1 {
font-size: .5em;
width: 100%;
}
p {
font-size: .2em;
width: 100%;
}
.slides li {display: none}
JavaScript
/*global jQuery */
/*!
* FitText.js 1.1
*
* Copyright 2011, Dave Rupert http://daverupert.com
* Released under the WTFPL license
* http://sam.zoy.org/wtfpl/
*
* Date: Thu May 05 14:23:00 2011 -0600
*/
(function( $ ){
$.fn.fitText = function( kompressor, options ) {
// Setup options
var compressor = kompressor || 1,
settings = $.extend({
'minFontSize' : Number.NEGATIVE_INFINITY,
'maxFontSize' : Number.POSITIVE_INFINITY
}, options);
return this.each(function(){
// Store the object
var $this = $(this);
// Resizer() resizes items based on the object width divided by the compressor * 10
var resizer = function () {
$this.css('font-size', Math.max(Math.min($this.width() / (compressor*10), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize)));
};
// Call once to set.
resizer();
// Call on resize. Opera debounces their resize by default.
$(window).on('resize', resizer);
});
};
})( jQuery );
(function($,sr){
// debouncing function from John Hann
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
var debounce = function (func, threshold, execAsap) {
var timeout;
return function debounced () {
var obj = this, args = arguments;
function delayed () {
if (!execAsap)
func.apply(obj, args);
timeout = null;
};
if (timeout)
clearTimeout(timeout);
else if (execAsap)
func.apply(obj, args);
timeout = setTimeout(delayed, threshold || 100);
};
}
// smartresize
jQuery.fn[sr] = function(fn){ return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); };
})(jQuery,'smartresize');
$('.flexslider').flexslider();
$(".slides").fitText();
$(window).smartresize(function(){ ...