0
votes

currently this is how I'm doing right now

$('.fancybox-inner').append(html);

suppose if there are two instances of fancybox opened, above code will append html to both instances of fancybox but I want to append it to current instance.

How can I achieve this ?

Any help is appreciated, Thanks.

1
give different id or class to various elements and then use $('#id1 .fancybox-inner') to select the particular boxn4m31ess_c0d3r

1 Answers

1
votes

Each instance contains variable $refs that is collection of references to DOM objects. So, you can change your snippet to:

$.fancybox.getInstance().$refs.inner.append(html);

btw, if you are executing this code from within callback, then you already have a reference to the instance (first argument)