add auto adapt height function