JS fix

Added check for sidebar before calling affix function