Add a debounce function and fixed css bug