Reputation:
I am using a fancybox on a page to edit some content. After closing the fancybox I am reloading the "parent"-page.
This works fine. But I am trying to set the parent page back to its original location (y-scroll). I get an integer from var tempScrollTop = $(window).scrollTop();
Now I am trying to set the parent document to this Y-offset. $("html,body").scrollTop(tempScrollTop) is NOT working.
thanks in advance!
$(".fancybox").fancybox({
css: {'background': 'none'},
'width' : '100%',
'height' : '100%',
'autoSize' : false,
closeClick : false, // prevents closing when clicking INSIDE fancybox
openEffect : 'elastic',
transitionIn: 'elastic',
transitionOut: 'elastic',
speedIn: 6000,
speedOut: 700,
closeEffect : 'none',
afterClose: function () {
var tempScrollTop = $(window).scrollTop();
parent.location.reload(true);
$("html,body").scrollTop(tempScrollTop);
},
})
Upvotes: 0
Views: 30
Reputation: 8769
First, it is quite obvious that 1) your js code would not execute while your page is reloading and 2) your question is not related to fancybox at all.
The real question is how to pass some parameter to new page - you can use query strings or (maybe even better) use cookies.
Upvotes: 0