calculating number of slides before every render