$( window ).resize(function() {
//First I took the fontSize of p in px
var logoHeight=$('#container').css('font-size');
//I took the window innerwidth in px.If i divide the window
// width/logoheight it produce 45.01 almost 45.This is a constant
//number that I use later as a factor to regulate the fontsize of paragraph
var windowWidth=window.innerWidth;
console.log(windowWidth);
var factor=45;
$('#container').css('font-size',(windowWidth/factor));
});
var logoHeightInit=$('#container').css('font-size');
var windowWidthInit=window.innerWidth;
var factor=windowWidth/parseInt(logoHeight);
$( window ).resize(function() {
var logoHeight=$('#container').css('font-size');
var windowWidth=window.innerWidth;
$('#container').css('font-size',(windowWidth/factor));
});
var logoHeightInit=$('#container').css('font-size');
var windowWidthInit=window.innerWidth;
var factor=windowWidth/parseInt(logoHeight);
$( window ).resize(function() {
var logoHeight=$('#container').css('font-size');
var windowWidth=window.innerWidth;
console.log(factor);
$('#container').css('font-size',(windowWidth/factor));
});
HTML:
Open in new window
JQuery:
Open in new window
You can calculate your window height and set a new factor constant