question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enhancement: Allow positioning the popup programatically.

See original GitHub issue

There are times where I don’t always want the popup positioned in the center of the screen. Actually, I prefer it to be centered and top, like chrome’s default alert. That way it doesn’t block whatever is covering the screen.

Currently, its possible with css, but not practical as you might not always want that:

.swal2-modal {
    margin-top: 0 !important;
}

Other possibilities could include: right left bottom top-right top-left …etc?

swal({
  //....
  position: 'top-left',
});

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

5reactions
toveruxcommented, Oct 16, 2017

in cases where you want to position the popup on top of a sidebar on one side of the screen or the other

Aha, that’s already possible with the target option 😃 Pass it the Swal parent container (body by default) and the modal will attach itself to it and displayed in the middle of it. So if you screen is divided in two parts for example, give Swal one of the two containers, and the modal will be perfectlty centered in it!

1reaction
gvernicommented, Feb 19, 2019

glad it worked now @Franki1986. I agree we should add an example, but it’s not easy with the design of the current documentation page. Let us think about it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Popup - .NET MAUI Community Toolkit - Microsoft Learn
The Popup view allows developers to build their own custom UI and present it to their users.
Read more >
Swift 4 Position of element programmatically - popup
Guys i use https://github.com/daisuke310vvv/PopupController library as PopUp my ... let popup = PopupController.create(YourViewController).
Read more >
<af:popup> - Oracle Help Center
A dialog can be repositioned on the page using drag-and-drop. The title bar is the gripper for the drag source. Dialogs will be...
Read more >
Popup Widget | jQuery Mobile API Documentation
See methods for information about setting the popup position programmatically, including the option to specify x and y coordinates.
Read more >
Enable Popups for each layer in webmap using ArcGIS API for ...
Confirmed with ESRI that is not possible to enable popups with ArcGIS API for Python. There is currently an enhancement in the ArcGIS...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found