How can I reset the scroll bar of a document when adding a layer above the document?
For example, it looks like a facebook page when you have a very long document and you need to scroll down to see old images / messages,

When you click on photos, the scroll bar has changed - it starts at the top, but the document page does not jump at all,

When you close the photo view layer, the scrollbar returns before it was before, but the page does not skip.
This is my working code so far, but it does not work the way I expect, like on facebook.
$('.get-photo').click(function(){ var object = $(this); var object_path = object.attr('href'); //alert(object_path); $(document.body).append("<div class='background-photo'></div>"); $(document.body).append('<div class="photos-holder"><img src="'+object_path+'" /></div>'); var layer_background = $('.background-photo'); var height_document = $(document).height(); var scroll_top = $(window).scrollTop(); layer_background.css({ width:'100%', height:height_document + 'px', background: '#fff', opacity: 0.4, position:'absolute', top:0, left:0, zIndex:'100' }); $('.photos-holder').css({ width:'800px', height:'500px', background:'#ffffff', border:'1px solid #000', marginLeft:'-400px', position:'absolute', top: scroll_top + 100 + "px", left:'50%', zIndex:"101" }); return false; });
Any ideas?
You can click the link, scroll and click on one of the photos to see what I mean.