Reputation: 39
solved with @jcubic code: "To get the value use $("#expand"+idxpand).css('overflow');"
alert(document.getElementById("expand"+idxpand).style.overflow);
Onclick if div overflow is set to hidden, expand the content . If is not set to hidden, set to overflow:hidde.
$('<div id="expand'+xpndid+'" style="position: relative;overflow-y: hidden;
max-height: 255px;"></div><a href="#" onclick="idxpand='+xpndid+';
expandimg();" >view photo</a>').prependTo('#mybox').hide().fadeIn('slow');
xpndid++;
function expandimg(){
if (document.getElementById("expand"+idxpand).style.overflow == 'hidden')
{
//do things}
else{
//set to hidden
}
}
I am unable to get the property. On alert I get empty value. Any idea?
Upvotes: 1
Views: 161
Reputation: 66488
I think that you get the wrong element, try:
<a href="#" onclick="idxpand='\'+xpndid+\'';expandimg();" >view photo</a>
Upvotes: 1