Hey there.
I'm pretty confident that the solution to my query is quite simple.
So, I have a .css file with this particular code snippet:
div.site
{
text-align:center;
border:2px solid #4b6c9e;
padding:1px;
margin-top:10px;
font-size:medium;
font-family:Verdana;
font-weight:bold;
height:25px;
}
Then comes the a .js file which constructs my div
using data from an xml. Here's an excerpt:
txt = txt + "<div class='site'><span class='link'><a class='nav' href='" + siteUrl[0].firstChild.nodeValue + "' target='_blank'>" + siteName[0].firstChild.nodeValue + "</a></span></div>"
document.getElementById('portalLinks').innerHTML = txt;
And in my .html file, I've got this:
<div id="portalLinks"></div>
Now, displaying the content on the page isn't an issue. But where I'm facing difficulty is in fetching the height for the site
class from my .css file. This is the code I'm trying to use:
var height = $(".site").height();
My goal here is to utilize this height
value to dynamically calculate and adjust the height of portalLinks
:
$("#portalLinks").css({ "height": newHeight }) - where the value of newHeight will be calculated based on `height`
Thanks a bunch in advance.