lightcase icon indicating copy to clipboard operation
lightcase copied to clipboard

Close link for inline lightcase

Open omikron opened this issue 5 years ago • 2 comments
trafficstars

Hello,

Is there any way to call lightcase.close() on a lightcase window opened via the inline tag data-rel="lightcase"?

Thank you

omikron avatar Jun 09 '20 22:06 omikron

Hi

lightcase.close() can be called from any element or event. However, you have to register it using javascript (not in HTML). The data-rel="lightcase" is just the default (out of the box) identificator for lightcase items. If you want to do advanced stuff, you can also initialize your lightcase links with something else and you will have full control of your HTML elements.

Example:

$( document ).ready(function() {
    $('a[data-rel="your-own-value"]').lightcase('init', {
        'onFinish': {
            // close lightcase automatically
            setTimeout(function () {
                lightcase.close();
            }, 5000);
        }
    });
});

Hope this helps.

cbopp-art avatar Jun 24 '20 05:06 cbopp-art

@cbopp-art I have lightcase loading a separate page in an iFrame, is it possible to close the parent lightbox from within the page loaded in the iFrame.

The above example doesn't work for me, nor does running lightcase.close() from an onClick event in the page loaded with lightcase.

Many thanks Jim

f13dev avatar Nov 09 '20 07:11 f13dev