• Resolved carot2016

    (@carot2016)


    Hello, all my photos are from external server, not in the WP media librairies.
    They all hava EXIF metadata (“ImageDescription” and “XPComment”) that we want to put in the caption and description.

    I’m using exif.js to get the metatada (EXIF.getData) and then set attributes like this :

    this.setAttribute('title', desc); // working
    this.setAttribute('data-caption-title', comment); // not working

    When I inspect the element in the browser I can see that the data-caption-title attribute is there but we don’t see it in Foobox.

    How can I do this.
    Thank you
    Caroline

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author bradvin

    (@bradvin)

    Hi Caroline,

    When are you running the code above? On jQuery ready? It seems like FooBox init code is running before your code, so when it runs, there is no caption title at that time.

    Thread Starter carot2016

    (@carot2016)

    Hello, I add this code in the Custom Javascript (Post) in FooBox settings.

    $('.fbx-instance').on('foobox.beforeShow', function(e) {
        var $element = $(e.fb.item.element), //the anchor tag
            $fooboxInstance = e.fb.instance, //the foobox instance
            $modal = e.fb.instance.modal.element; //the modal object
        //your custom code goes here...
        console.log($element.data('data-caption-title'));
        e.fb.item.title = $element.data('data-caption-title');
    });

    I can see in the console the data-caption-title with good info. But nothing appear when fooBox open.
    Caroline

    Thread Starter carot2016

    (@carot2016)

    Resolve, I hooked on foobox.alterCaption event instead, my error.
    Very good plugin, thank you.

    Caroline

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘data-caption-title dynamically from exif data’ is closed to new replies.