Question

I just finished and turned in a homework assignment where the goal was to 'dynamically resize text with JavaScript styles'. We had a few paragraphs with a certain class on them, and those were the ones we were supposed to resize.

Now, if you a CSS file that says the text is X size, and then when the page loads you use JavaScript to get that value & make it larger. Would that be considered dynamically changing the size?

What it turns out the teacher actually wanted was to change the text size when the window is resized, but it seems what he actually asked for was pretty open ended.

Just trying to get an idea of what qualifies as dynamic resizing.

Thanks for any insight..

            function setGreekSize() // change the height of text w/ 'greek' class
        {
            var currentSize = parseInt($("#content").css("font-size"))*1.2;
            $(".greek").css("font-size", currentSize+"px");
        }

I had that in a function for when the document was ready. Somewhat pointless, I know, but he said not to try to get too 'fancy' with the homework assignment.

Was it helpful?

Solution

Dynamic resizing is resizing the text based on an event or action... It was one size then changed due to event. I would argue that resizing it once the page loads may be valid but how would the user know what the original font was and what the new font is? the only person who knows it is dynamic is the developer. Yes if there was some logic or reasoning behind it fine. I would change your example to add a timer that way the user can see the original size and after a few seconds it changes. Ir maybe the user clicks a button and the text grows...

Do you need sample code?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top