I am looking to merge two functional JSFiddle projects and have them work in conjunction with each other.
JSFiddle-1 : http://jsfiddle.net/MYSVL/3050/
window.onresize=function() {
var child = $('.artist');
var parent = child.parent();
child.css('font-size', '18px');
while( child.height() > parent.height() ) {
child.css('font-size', (parseInt(child.css('font-size')) - 1) + "px");
}
The content within the artist container in this project is responsive, adjusting to the maximum font size when the screen is larger, and minimizing to smallest font size on a smaller screen.
JSFiddle-2 : http://jsfiddle.net/MYSVL/3047/
function calcDivHeights() {
window.onresize=$(".artist").each(function () {
var child = $(this);
var parent = child.parent();
//child.css('font-size', '18px');
while (child.height() > parent.height()) {
child.css('font-size', (parseInt(child.css('font-size')) - 1) + "px");
}
});
}
In this second project, the function is examining every artist div and readjusting the font size based on the while condition. However, I am facing difficulties in making it responsive like my JSFiddle-1. Once the text size decreases, it remains small even if I enlarge the screen. I aim for JSFiddle-2 to operate exactly like JSFiddle-1, ensuring that the text responsive adapts to the screen size.
If anyone can assist me or modify my JSFiddle-2 to achieve this objective, I would greatly appreciate it.
Thank you in advance.