I'm using the following code in an onAppend
function to scroll to the top of any page.
The scroll should fire after a play button is clicked and a YouTube vid is starting to load - the function has a onAppend
event which works fine...
So I just need the scroll function. Now I tried to implement this code just to all of my single WordPress posts.
EDIT: The solution on jQuery scroll to element does not work in this case. So the "possible duplicate" request should be ignored.
var body = jQuery("html, body");
body.stop().animate({scrollTop:0}, 500, function() {
// alert("Finished animating");
});
The HTML of the single posts looks like
<html prefix="og: http://ogp.me/ns#" lang="en-US">
<head>...</head>
<body class="post-template-default single single-post postid-880">
<nav id="menu" class="xs-menu">....</nav>
<div id="single-post-wrapper" class="single-post-class">
...
</div>
</body>
</html>
Any idea how to scroll ONLY to the top of the single posts in WordPress - for example to the #single-post-wrapper
or to the top top of the entire post?