Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var measure= document.createElement('div');
- measure.style.height= '10em';
- document.body.appendChild(measure);
- var size= measure.offsetHeight/10;
- document.body.removeChild(measure);
- p {
- font-size:2em;
- }
- body {
- font-size:0.625em;
- }
- p {
- font-size:2em;
- }
- $(window).resize(resize); // update when user resizes the window.
- $("body").append("<p id='textSizeReference' style='display:none;padding:0'>T</p>");
- var refTextHeight = $("#textSizeReference").height();
- setInterval(function() {
- var h = $("#textSizeReference").height();
- if (h != refTextHeight) {
- refTextHeight = h;
- resize(); // update when user changes text size
- }
- }, 500);
Add Comment
Please, Sign In to add comment