Skip to content

lightcase plugin doesn't work on first click - on me #176

@zonky2

Description

@zonky2

Hi, I change an old site and I`ll replace the colorbox to lightcase

at old site: https://www.gut-cert.de/produkte/nachhaltigkeit/lieferketten/rspo.html see the SVG-Image at end of the site and click at one hotspot...

I change the code to

    <script>
        $(document).on('click', '.lightcase_content', function (event) {
            event.preventDefault();
            let $this = $(this);
            $this.lightcase({
                maxWidth: '95%',
                maxHeight: '95%',
                opacity: '0.5',
                inline: {
                    width: 'auto',
                    height: 'auto'
                },
                href: $this.attr('xlink:href'),
            });
            console.log('click lightcase_content');

            $('.lightcase_close').click(function () {
                console.log('click close');
                $('.lightcase-icon-close').click();
            });
        });
    </script>

btw: xlink:href because svg links

and works, but the lightcase opens only at the second click - the same at my "<"/">"-Buttons

at console I can see, that the click fire every time

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions