Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.8k views
in Technique[技术] by (71.8m points)

javascript - Can you remove the 'flash animation' between modals on sweet alert 2

I'm using sweet alert 2 to chain modals together.

I was hoping to get the transition between modals as seamless as possible (removing the animation with hideClass & showClass. However, there is still a very noticeable 'flash' or blink when pressing continue between the modals.

Here's what I have:

Swal.mixin({
  confirmButtonText: 'Continue',
  confirmButtonColor: '#04D4CD',
})
  .queue([
  {
    title: 'Welcome to blah blah!',
    text: 'To get started we'll need some information from you',
    imageUrl: 'https://unsplash.it/400/200',
    imageWidth: 400,
    imageHeight: 200,
    hideClass: {
    popup: '',
    icon: '',  
    },
  },
  {
   title: 'Question 2', 
   text: 'More text is here.',
   imageUrl: 'https://unsplash.it/400/200',
   imageWidth: 400,
   imageHeight: 200,
   showClass: {
    popup: '',
    icon: '', 
  },
  hideClass: {
    popup: '',
    backdrop:'',
    icon: '',
  },
  },
  {
   title: 'Question 3', 
   text: 'Thats it!', 
   imageUrl: 'https://unsplash.it/400/200',
   imageWidth: 400,
   imageHeight: 200, 
   confirmButtonText: 'Get Started',
   showClass: {
   popup: '',
   icon: '',  
  }, 
  }
])

And a codepen where you can see the flash - https://codepen.io/matt-tailwise/pen/vYXMVGJ.

Is there anyway to remove this?

Thanks for your help!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The keys you are using to configure (CSS classes for animations when showing/hidden a popup) sweetalert are empty. Delete hideclass and showclass. Delete:

showClass: {
   popup: '',
   icon: '',  
}, 

and

hideClass: {
    popup: '',
    backdrop:'',
    icon: '',
},

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...