Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How can I set the iframe title for lightview?

We commonly use lightview with an iframe, but for accessibility we need to set the iframe title.

I have tried to get a hold of the iframe in the onShow callback, but apparently the iframe does not yet exist when that is called. The best I can do is use setTimeout, like this:

onShow: function() {
    setTimeout(function() {
        $('.lv_window').find('iframe').attr('title', 'My Title');
    }, 1000);
}

But I don't think having such a delay is an acceptable work-around.

Using "inline" and creating the iframe myself is also not an option because even if I delay the creation of the iframe until onShow is called, it still gets moved twice in the DOM, which causes the iframe to get loaded three times, rather than just once.

Is there another way to set the iframe title, or would lightview need to be modified to support the setting of the iframe title?

Thanks,
John

Sign In or Register to comment.