added windowwidth as parameter to callback