javascript - Is there a way to tell what direction the state is going with history.js? -
like title says, i'd able perform different onstatechange
event if pushstate
function called, instead of back
function. or, if go
function negative or positive.
example:
if history.pushstate()
or history.go(1)
called, want statechange
event's callback forwardpushstate
if history.back()
or history.go(-1)
called, want statechange
event's callback backwardspushstate
a state data related page (as user see in browser). if user wants in page, page same, either if coming button click or forward button click, think.
pushstate pushes new state in stack. has no relationship back
, go
. back
, go
functions navigate on pushed states in stack. because in edit, looks thinking pushstate , go(1) equivalent.
maybe if want know direction user coming, should analyse onstatechange
event know if takes parameter stores direction. still don't know how do.
the main thing think, has no relationship go (-1)
or go(1)
or back
.
Comments
Post a Comment