Skip to content

Modals for dynamic content #136

@openbrian

Description

@openbrian

We have HTML content that's added to the page dynamically. It would be nice to initialize modals for just this tree of elements. We could initialize the entire document again, but doesn't that add multiple triggers ( triggerMap[targetModal].push(trigger); )?

Would something like this work?

old - var triggers = [].concat(toConsumableArray(document.querySelectorAll('[' + options.openTrigger + ']')));
new - var triggers = [].concat(toConsumableArray(document.querySelectorAll(options.openTriggerQuery)));

Micromodal.init({openTriggerQuery: '#newstuff * [data-micromodal-trigger]'})

or maybe this
var triggers = [].concat(toConsumableArray(document.querySelectorAll(options.root + '[' + options.openTrigger + ']'));

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementUser is requesting an enhancement/new feature

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions