The Wayback Machine - https://web.archive.org/web/20200716101440/https://github.com/t4t5/sweetalert/issues/842
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Icon overlaps content if using custom content without text #842

Open
ocastadaniel opened this issue Jun 11, 2018 · 1 comment
Open

Icon overlaps content if using custom content without text #842

ocastadaniel opened this issue Jun 11, 2018 · 1 comment

Comments

@ocastadaniel
Copy link

@ocastadaniel ocastadaniel commented Jun 11, 2018

If you set the content option to a custom element, without text or a title, but you do add an icon, the icon overlaps the content.

Example here in jsfiddle

https://jsfiddle.net/spyrnx35/11/

var div = document.createElement('div');
var content = document.createTextNode("Hello world, this get's overlapped");
div.appendChild(content);
swal({
    icon: 'success',
    content: div
  });

outputs as follows:

screen shot 2018-06-11 at 11 09 02

@maliming
Copy link

@maliming maliming commented Oct 1, 2019

hi @ocastadaniel
I think you can try div.style = 'position: relative;';

var div = document.createElement('div');
div.style = 'position: relative;';
var content = document.createTextNode("Hello world, this get's overlapped");
div.appendChild(content);
swal({
    icon: 'success',
    content: div
  });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.