It depends on if you're using infinite scroll. Assuming it's standard Masonry, with all elements in a page on load, you could easily add/read a cookie that stores their vertical location in the document. You can use HTML5 local storage to keep that value, as well.
My masonry layout doesn't hold when using the back button.
When I click the back button from a permalink, it sends me back to the top of the page.
I understand this is a problem for jquery.
What's a good way to implement a history plugin to my code?
It depends on if you're using infinite scroll. Assuming it's standard Masonry, with all elements in a page on load, you could easily add/read a cookie that stores their vertical location in the document. You can use HTML5 local storage to keep that value, as well.