Skip to content
A tiny jquery plugin for google keep like textfitting
JavaScript HTML
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
dist
example
src
.gitignore
Gruntfile.js
README.md
bower.json
package.json

README.md

textboxfit.js

A tiny jquery plugin for google keep like textfitting. It's AMD ready for use with requirejs.

Install

Install textboxfit with bower

bower install textboxfit

...or just download it.

Demo

http://janstuemmel.github.io/textboxfit.js/demo.html

Usage

<html>
<head>
    <title>Textboxfit</title>
    <script src="bower_components/textboxfit/dist/textboxfit.js"></script>
    <style>
        .box{
            /* both required*/
            width: 300px;
            min-height: 200px;
        }
    </style>
    <script>
        S(document).ready(function(){
            $('.box').textboxfit({
                // default options
                minFontSize: 48,
                maxFontSize: 12,
                fixSize: false
            });
        });
    </script>
</head>
<body>
    <div class="box">A text</div>
    <div class="box">foo</div>
    <div class="box">Lorem Ipsum</div>
</body>
</html>

Todo

  • Bind resize for responsive boxes
  • allow width orientation
  • provide min package
Something went wrong with that request. Please try again.