Instead of trying to grab the 'accordion item is open', why not set an invisible div on top, give it a class on your own and scroll to there instead? Your function might run before the accordion changes, and then you'd be scrolling somewhere you didn't intend to
↧