Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

jquery textfill example

//<script src="jquery.min.js"></script>
//<script src="jquery.textfill.min.js"></script>
//<script>
$(function() {
    $('#my-element').textfill({
      	// AVAILABLE OPTIONS - 
      	//option: defaultValue
        minFontPixels: 4,			
      	maxFontPixels: 40,
      	innerTag: span,
      	widthOnly: false,
      	explicitWidth: null,
      	explicitHeight: null,
      	changeLineHeight: false,
      	allowOverFlow :false,
      	debug: false,
    });
});
//</script>

/*
Name				Description	
--------------------------------
minFontPixels		Minimal font size (in pixels). 
					The text will shrink up to this value.
maxFontPixels		Maximum font size (in pixels). The text will stretch up to this value.. 
                    If it's a negative value (size <= 0), 
                    the text will stretch to as big as the container can accommodate.
innerTag			The child element tag to resize. We select it by using 
					$(innerTag + ':visible:first', container)
widthOnly			Will only resize to the width restraint. 
					The font might become tiny under small containers.
explicitWidth		Explicit width to resize. 
					Defaults to the container's width.
explicitHeight		Explicit height to resize. 
					Defaults to the container's height.
changeLineHeight	Also change the line-height of the parent container. 
					This might be useful when shrinking to a small container.
allowOverflow		Allows text to overflow when minFontPixels is reached. 
					Won't fail resizing, but instead will overflow container.
debug				Output debugging messages to console.
*/
Source by github.com #
 
PREVIOUS NEXT
Tagged: #jquery #textfill
ADD COMMENT
Topic
Name
3+8 =