Sheet modal closed bu continue to open when navegate some other pages

Hi i have some problems with sheet modal, I created a sheet modal and put in a page when logIn in app modal, open. When user and password is authenticated i close sheetmodal and redirect to home page, so if i click in any home link the modal continue to display in home page, so i have try destroy modal passing $el so not working, please someone help me
the way i create sheet modal:
sheetDefineSenhaApp = app.sheet.create({
el: ‘.defineSenhaApp’,
closeByOutsideClick: false,
closeByBackdropClick: false,
closeOnEscape: false
});
app.sheet.open(’.defineSenhaApp’, true);

to destroy :
app.sheet.destroy(sheetDefineSenhaApp);

i dont fully understand your question, but i think that destroy will destroy the instance, not remove it from dom.

so i would first close the modal, and on closed event destroy it

app.sheet.close('.defineSenhaApp', animate)
closed sheet sheet Event will be triggered after Sheet completes its closing animation. As an argument event handler receives sheet instance
sheetClosed sheet app

https://framework7.io/docs/sheet-modal.html#app-and-sheet-instance-events

1 Like

Thanks … it works now, i found my mistake,
i was create a sheet modal inside init page event, but was missing to set whitch page is
when a put

'.page[data-name="pgDefineSenha"]'  as parameter to event it works nicely

this is the wrong way

$$(document).on('page:init', function (e) {
		sheetDefineSenhaApp = app.sheet.create({
		  el: '.defineSenhaApp',
		  closeByOutsideClick: false,
		  closeByBackdropClick: false,
		  closeOnEscape: false
		});
		app.sheet.open('.defineSenhaApp', true);
	})

this works fine

$$(document).on('page:init', '.page[data-name="pgDefineSenha"]', function (e) {
		sheetDefineSenhaApp = app.sheet.create({
		  el: '.defineSenhaApp',
		  closeByOutsideClick: false,
		  closeByBackdropClick: false,
		  closeOnEscape: false
		});
		app.sheet.open('.defineSenhaApp', true);
	})
2 Likes