How to save in sessionStorage the slidebox index

I have a Slide-box with 5 slides, each with a list of items. When I click on an item opens another view.
If I’m on the second slide, I click an item and change the view, to go back (to slide-box) back to the first slide, not the second, which is where I was …

I wish I could save slide index in sessionStorage and use it to return to the slide-box, but do not know how.