I donβt know whether I will implement it or not, since the frames take a noticeable amount of time to load, and the user can already scroll the page and return to the hash element, but here I decided to use jQuery.
Since frames are replaced in the document after the initial load, you can use the .load() function, which usually never works if you just use it in the document.
Just add this jQuery code to the script tag, where you replace all the pre code :
Code:
$('iframe').load(function() { moveToHash(); });
Edit: There were several bugs and unnecessary in the code that are now fixed.
source share