Good day to all. Help, please, write a function to determine the height of the block. I have a block whose height I need to determine. It will have some text content of arbitrary size. By default, some height is indicated, and if the content in the block is larger than it, the "show all block" button appears (show, hide). The function must somehow get the id of the element. I have an option, but this is not a function, but not a very convenient script.
$('#full').click(function(){ $('#news1').stop().animate({height:'240px'}, 300, 'easeInCubic'); $('#full').hide("slow"); $('#smol').show("slow"); }); $('#smol').click(function(){ $('#news1').stop().animate({height:'100px'}, 300, 'easeInCubic'); $('#smol').hide("slow"); $('#full').show("slow"); }); In JS is not strong. Who can do what, tell me, please, or mb where such functions have been seen. I will read, I will understand. For any help, I will be grateful. The most important thing is that the height of the block is determined automatically and deployed to the whole block, depending on any number of contents. And the initial size was set at the beginning to some specific value or was passed by the parameter to the function itself (not very important).