JQuery Control Text Box Automatically reduces font fill

JS Control Text Box automatically reduces font fill, when the font in the text box exceeds the text box range, the font within the box will automatically shrink to fill the entire text box;

call: RESETFONTSIZE ($ (". Title", 50, 10, 20); // Reset Font Size

Wordbox: jQuery Object
MaxHeight: Box maximum height
minsize: Minimum font size
maxSize: Maximum font size

  rRESETFONTSIZE = Function (Wordbox, MaxHeight, Minsize, MaxSize) {// var wordbox = $ (". Products .title "); // Maximum height // var maxHeight = 30; // Initialization text size is the smallest WordBox.css ('font-size', minsize +" px "); maxSize ++; wordbox.each (Function () {// Cycle the size until larger than the maximum height for (var i = minsize; i  maxheight) {// When the height of the container is greater than the maximum height, the previous attempt is optimal. $ (This). CSS ('font-size', (i - 2) + 'px'); // End cycle Break;} else {// If less than the maximum height, text size plus 1 continues to try $ (this) .css ('font-size', i + 'px');}}});};  
The above is the jQuery control text box for Xiaobian to introduce. Reduce the font fill, I hope to help everyone. If you have any questions, please leave a message, the small package will reply to everyone. Thank you very much for your support of Tumi Cloud Website!
© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment