fancybox with Ajax start at the top?

36 views
Skip to first unread message

CL65 Captain

unread,
Mar 25, 2009, 3:24:27 AM3/25/09
to fancybox
I have two fancyboxes on a page that load another page in the box.
They work great with one exception. If I click the link of one of
them and scroll down and then click on the other it loads the page but
it is already scrolled to the bottom instead of starting on the top.

?

Rances

unread,
Apr 21, 2009, 3:56:48 AM4/21/09
to fancybox
Same problem here. I tried using scrollto plugin :
$.scrollTo.defaults.axis = 'y';
$.scrollTo(0); //reset the screen to (0,0)

does not work.

scroll(0,0);

also not working...

waiting for help




On 25 mrt, 09:24, CL65 Captain <flyc...@gmail.com> wrote:
> I have two fancyboxes on a page that load another page in the box.
> They work great with one exception.  If I click the link of one of
> them andscrolldown and then click on the other it loads the page but

pbarney

unread,
Apr 22, 2009, 10:00:52 AM4/22/09
to fancybox
You want to use the 'callbackOnShow' option.

Make sure that you are using Ariel Flessler's scrollTo plugin
http://flesler.blogspot.com/2007/10/jqueryscrollto.html

Then, make your fancybox initialization something like this:

<pre>
$("a.morelink").fancybox({
'frameWidth': 640,
'frameHeight': 480,
'overlayShow': true,
'overlayOpacity': .5,
'hideOnContentClick':false,
'callbackOnShow': function(){ $('#fancy_ajax').scrollTo(0,
0); }
});
</pre>

Frankie Bailey

unread,
Sep 21, 2017, 9:40:11 PM9/21/17
to FancyBox
Oh wow, zombie post, sorry. I was having a similar issue with inline content. For me, Fancybox was scrolling to the first link to appear in the div when a user clicked the next/previous navigation. Very frustrating for the user, who then had to scroll back up to see the entirety of the text. Not any issue if your divs are all the same height, but mine had a wide variance.I added a hidden link at the top of the content on all my divs, which while not an ideal fix, did resolve the issue for me. The scrollto plugin recommendation did not work. 
Reply all
Reply to author
Forward
0 new messages