Код: Выделить всё
...
9 jQuery(document).ready(function ( event ) {
10
11 // ## ALIAS ##
12 $ = jQuery;
...
30 const init = _ => {
31
32 overlay();
33 lightbox();
34 pagination_setup();
35 shrink_to_fit();
36 }
37
38 _window.resize( _ => {
39
40 shrink_to_fit();
41 });
...
170 const shrink_to_fit = _ => {
171
172 let text = $('h1, h2, h3, h4, h5, h6');
173
174 text.each( function( i, v ) {
175
176 v = $(v);
177 v.css( 'font-size', '' ); // Returns text to normal for growing device widths
178 let p_width = parseInt( v.parent().width() );
179 let f_size = parseInt( v.css( 'font-size' ) );
180
181 while ( parseInt( v.prop( 'scrollWidth' ) ) > p_width && f_size > 10 ) {
182
183 v.css('font-size', --f_size + 'px' );
184 }
185 } );
186 }
187
188 init();
189 });
tia < /p>
Подробнее здесь: https://stackoverflow.com/questions/796 ... -container
Мобильная версия