Skip to content

Modal trigger <a> with some <img> or <div> in it breaks Modal : it won't open #48

Description

@LeoFlandin
<a href="#" class="modal-trigger" data-options='{ "modalId": "example-modal" }'>
    <img src="http://placehold.it/50x50">
    <span>Boom !</span>
</a>

<div class="modal" id="example-modal">
    <a href="#" class="modal-close right">X</a>
    <p>This is a modal</p>
    <p>This is a modal</p>
    <p>This is a modal</p>
    <p>This is a modal</p>
</div>

Javascript error :
Uncaught TypeError: Cannot read property 'modalId' of undefined barekit.js:225

dirty fix line 225 :
$(e.target).closest('.modal-trigger').data("options").modalId
instead of
$(e.target).data("options").modalId

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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