0
votes

I am trying to load a new URL to an Iframe by calling the next method on fancybox but i have not been able to get it to work.

I know I can close a fancybox within an iframe using

parent.$.fancybox.close();

using parent.$.fancybox.next() however doesn't work

Is there no provision for this or am i doing something wrong

<a href="javascript:void(0)" onclick="goToNext()">next</a>

function goToNext()
{
parent.$.fancybox.next()

}

i resulted to doing this as I could not get the next and prev button to show even after setting the cyclic and showNavArrows options to true

1
parent.$.fancybox.next(); - works for meJanis

1 Answers

0
votes

On the parent page, just set the same data-fancybox-group attribute (use a HTML5 DOCTYPE too) to your anchors that trigger the fancybox iframes like:

<a href="page01.html" class="fancybox fancybox.iframe" data-fancybox-group="mygroup">open iframe 01</a>
<a href="page02.html" class="fancybox fancybox.iframe" data-fancybox-group="mygroup">open iframe 02</a>
<a href="page03.html" class="fancybox fancybox.iframe" data-fancybox-group="mygroup">open iframe 03</a>

etc.

then fancybox will automatically show the navigation arrows to move between next/prev iframe.

On the other hand, you still may use the manual method to move between elements of a gallery, however parent.$.fancybox.next(); would only work if you have set the same data-fancybox-group attribute, otherwise fancybox has no means to know which one is the next element of the group.

NOTE: this is for fancybox v2.x