code sample from https://github.com/ccoenraets/PageSlider