Skip to content

Won't trigger a second time when used as part of an async HTML partial #82

@michael-zock

Description

@michael-zock

Hi

I have a situation where the time picker is used in a modal popup that's loaded using Magnific Popup.

The first time, everything works as expected, but if I close the popup and open it again, clicking the text field won't trigger anything anymore.

I've already tried to call the refresh every time the partial is loaded again (in case something needs to be triggered again) and I've extended the popup's close() method to include a call to your plugin's destroy method, made my JS more verbose to exclude problems caused by the use of shorthan methods (e.g., access by helper class instead of ID), but no dice.

$("#beginTime").timepicker({
    showPeriodLabels: false
});

$("#endTime").timepicker({
    showPeriodLabels: false
});

$("#beginTime").timepicker("refresh");
$("#endTime").timepicker("refresh");

$.magnificPopup.instance.close = function () {
    $("#beginTime").timepicker("destroy");
    $("#endTime").timepicker("destroy");

    $.magnificPopup.proto.close.call(this);
};

Has anybody run into a similar situation before?
I'm not sure if this is an incompatibility or if this use case just required an additional step that's just not in the documentation.

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