0

Currently I have the following code. This is on Fancybox pop up window. I'm not sure if that's relevant or not.

        $.fancybox.open({
        href: "#preview_image_img",
        title: "This is only a preview text may be adjusted to look its best.",
        closeBtn    : true,
        openEffect  : 'elastic',
        closeEffect : 'elastic',
        scrolling   : 'no',
        overlayShow: false,  
        fitToView: true,
    afterLoad : function( instance, current ) {
        console.log(instance);
    }
         })

afterLoad I console.log this object from the callback 'instance'. It appears on my console like so.

enter image description here

It's a list of an object with a bunch of methods etc.
if I console.log instance.key, instance.content etc all those return a value. When I do instance.dim (which coincidently is the one I need) I get undefined. How can I get the value of that?

enter image description here

Matt Croak
  • 2,788
  • 2
  • 17
  • 35
FabricioG
  • 3,107
  • 6
  • 35
  • 74
  • 1
    It's being set after your log statement runs. `console.log` writes a reference to the object to the console, which doesn't get resolved until you expand it. –  Nov 07 '19 at 20:29
  • 1
    See also [console.log() async or sync?](https://stackoverflow.com/questions/23392111/console-log-async-or-sync) – trincot Nov 07 '19 at 20:50

0 Answers0