Custom attribute for normal button with function to close modal


I know that it’s not possible to move the close button of a modal inside of the modal box.

I am trying to use the custom attributes to give a normal button the functionality of the modal close button.

When I use "data-x-toggle-close=“1"” for the name of the custom attribute my normal button closes the modal but the content of the page does not stay in the right position. It always jumps to the top of the page.

How can I achieve to have the exact same functionality of the modal close button?

Thank you.

Hey Ingo,

Thanks for reaching out!

You can check this thread that might help you with your issue.

Hope that helps.


thanks a lot for the answer.

It helped.

But now i still have the issue that after closing with the new button the screen jumps to the top of the page. The URL gets a # added…

Is there a way to avoid this?

Thanks for your help!

Hi @ingo,

Please remove the # from the Link > URL attribute of the Button as shown in the given screenshot.

Hope it helps.


Thanks for the quick help!

Hey Ingo,

You’re welcome! If you have any other concerns or clarifications regarding our theme features, feel free to open up a new thread.

Thank you.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.