Change index on open()

Skip to first unread message

Yogi Barista

Oct 10, 2017, 10:49:53 PM10/10/17
to FancyBox
Is this basic idea possible, and if so, how?

$('.myTriggerElement').on('click', function() { $ [ {imageObject}, {imageObject} ], { option:value, option:value }, function() { var index = 2; //calculate value of index;  return index;} ) } );

Having created the click event to open fancybox with an array of images, I want to change the starting image index, depending on other things that may have happened on the page.

When I try to use function(){} for the index value, fancybox just ignores me and defaults to 0.

Yogi Barista

Oct 11, 2017, 12:50:13 AM10/11/17
to FancyBox

I think I've worked out the problem - Index doesn't support a callBack, so I need to block with a standard function to get the value.

Once I made that change it seemed to work.
Reply all
Reply to author
0 new messages