PluginProbe
Easy Bootstrap Shortcode / 2.5
Easy Bootstrap Shortcode v2.5
trunk 2.4.0 2.5 3.4 3.5 3.6 3.7 4.0.0 4.4 4.5 4.5.4 5.0.0 5.0.1 5.0.2
easy-bootstrap-shortcodes / js / jquery.fittext.js

jquery.fittext.js in Easy Bootstrap Shortcode 2.5, at js/jquery.fittext.js

51 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /*global jQuery */
2 /*!
3 * FitText.js 1.2
4 *
5 * Copyright 2011, Dave Rupert http://daverupert.com
6 * Released under the WTFPL license
7 * http://sam.zoy.org/wtfpl/
8 *
9 * Date: Thu May 05 14:23:00 2011 -0600
10 */
11
12 (function( $ ){
13
14 $.fn.fitText = function( kompressor, options ) {
15
16 // Setup options
17 var compressor = kompressor || 1,
18 settings = $.extend({
19 'minFontSize' : Number.NEGATIVE_INFINITY,
20 'maxFontSize' : Number.POSITIVE_INFINITY
21 }, options);
22
23 return this.each(function(){
24
25 // Store the object
26 var $this = $(this);
27
28 // Resizer() resizes items based on the object width divided by the compressor * 10
29 var resizer = function () {
30 $this.css('font-size', Math.max(Math.min($this.width() / (compressor*3), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize)));
31 };
32
33 // Call once to set.
34 resizer();
35
36 // Call on resize. Opera debounces their resize by default.
37 $(window).on('resize.fittext orientationchange.fittext', resizer);
38
39 });
40
41 };
42
43 })( jQuery );
44 jQuery(document).ready(function(){
45 jQuery('h3.ebs-caption').fitText(7);
46 jQuery('p.ebs-caption').fitText(10);
47 jQuery('.ebs-carousel').on('slid.bs.carousel', function () {
48 jQuery('.ebs-carousel').find('h3.ebs-caption').fitText(7);
49 jQuery('.ebs-carousel').find('p.ebs-caption').fitText(10);
50 })
51 })