So I have code like this that I want to execute every time an accordion item is opened or closed:
var tabletContent = parseFloat($('.twoCol').css("height") + $('.sideColumn').css("height"));
if (tabletContent > 400)
I've tried to insert it into $.widget in places that seem relevant, like
But tabletContent ends up not being the actual value of for example the expanded content. The value changes somewhat, I can see that in FF dev tools, but it's like 1000px when it should be 1400px etc. How to go about this?
But where should this code go in relation to the $.widget ? Actually they are h6 elements with the class .accordion, should I have it be $('h6').accordion ? I didn't build this site myself, just helping to get it mobile friendly.
Ok, I created a fiddle and got help from IRC (thanks, lathan). The problem was it was a custom accordion and I was too ignorant to understand this. Here is a working fiddle: http://jsfiddle.net/lathan/seqKm/1/
Now that I got the change event working, I can see that having a function that gets layout element heights and changes another element based on those is not working. The function is executed too early and the height it gets is not the one it is supposed to be after accordion open/close. I wonder what would be a way around this?