update scroll function