Detecting a pages transition direction?

Detecting a pages transition direction?

Hi, is it possible to detect an event when a page is hidden on the forward state only?

For example if the page goes to another in a forward direction a function is called, but in a backwards direction it isn't.

Or is it possible to detect the direction of the transition?

Thanks,