I created a portfolio in Wordpress with the posts that open directly on the same page. Has been difficult, but I managed - following these steps - to make everything work... or almost.
What I want now is to make sure that, when the user clicks on an element, the page scroll to top to view the product details. I tried in all ways without success :(
This is the website: http://www.grafichepioppi.it/category/portfolio/
This is my code:
$(document).ready(function(){
$.ajaxSetup({
cache:true,
async: true,
complete:function(){
$('body,html').animate({scrollTop: 0}, 800);
}});
$("a.link-portfolio").click(function(){
var post_url = $(this).attr("href");
var post_id = $(this).attr("rel");
$("#portfolio-featured").html("<div class='loading-ajax'></div>").fadeIn(500);
$("#portfolio-featured").load(post_url, function() {
$('.portfolio-featured').show( 4000 );
});
window.location.hash = post_id;
return false;
});
});
Any ideas on how can I do that?