Forums
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › Function not being updated correctly
@Alen just replaced your code with mine, but still the left sidebar is not showing up… Is this a local problem?
You’re executing the function on something that’s removed with the Ajax call whenever a link is clicked – including the inline style that makes it visible. Instead you’d better apply it to the new content after it’s loaded.
I’m very very new to JS, so could you please help me out?
You need to call calcLeftWrapper();
when the page is done fading in.
In your code, try:
/* code emmited for brevity */
$mainContent.fadeIn(200, function() {
$pageWrap.animate({
height: baseHeight + $mainContent.height() + "px"
});
calcLeftWrapper(); /* fn call */
});
Thanks helped!
Just a side note, realising all this isn’t needed either :
$(function() {calcLeftWrapper()});
Because even this’ll do :
$(calcLeftWrapper);