Skip to content

Commit

Permalink
fixed animation issue
Browse files Browse the repository at this point in the history
fix #59
  • Loading branch information
realrashid committed Nov 27, 2019
1 parent 415bf34 commit 084f265
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion resources/views/alert.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@if (Session::has('alert.config'))
@if(config('sweetalert.animation.enable') && !empty(config('sweetalert.animatecss')))
@if(config('sweetalert.animation.enable'))
<link rel="stylesheet" href="{{ config('sweetalert.animatecss') }}">
@endif
<script src="{{ $cdn?? asset('vendor/sweetalert/sweetalert.all.js') }}"></script>
Expand Down
20 changes: 10 additions & 10 deletions src/Toaster.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ protected function setDefaultConfig()
'heightAuto' => config('sweetalert.height_auto'),
'padding' => config('sweetalert.padding'),
'showConfirmButton' => config('sweetalert.show_confirm_button'),
'showCloseButton' => config('sweetalert.show_close_button'),
'showClass' => [ 'popup' => 'animated fadeInDown faster'],
'hideClass' => [ 'popup' => 'animated fadeOutUp faster'],
'showCloseButton' => config('sweetalert.show_close_button')
];
}

Expand Down Expand Up @@ -432,18 +430,20 @@ public function focusCancel($focus = false)

/*
**
* Custom animation with [Animate.css](https://daneden.github.io/animate.css/)
* CSS classes for animations when showing a popup (fade in):
* CSS classes for animations when hiding a popup (fade out):
* @param array $showClass
* @param array $hideClass
* @param array $showAnimation
* @param array $hideAnimation
* @return RealRashid\SweetAlert\Toaster::alert();
*/
public function animation($showClass = [], $hideClass = [])
public function animation($showAnimation, $hideAnimation)
{
unset($this->config['showClass']);
unset($this->config['hideClass']);
$this->config['showClass'] = $showClass;
$this->config['hideClass'] = $hideClass;
if(!config('sweetalert.animation.enable')){
config(['sweetalert.animation.enable' => true]);
}
$this->config['showClass'] = ['popup' => "animated {$showAnimation}"];
$this->config['hideClass'] = ['popup' => "animated {$hideAnimation}"];
$this->flash();

return $this;
Expand Down
9 changes: 4 additions & 5 deletions src/config/sweetalert.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,17 @@
|--------------------------------------------------------------------------
| Animation
|--------------------------------------------------------------------------
| If set to false, modal CSS animation will be disabled.
| Custom animation with [Animate.css](https://daneden.github.io/animate.css/)
| If set to false, modal CSS animation will be use default ones.
| For specific modal just use the animation() helper method.
|
*/

'animation' => [
'enable' => env('SWEET_ALERT_ANIMATION_ENABLE', true),
'showClass' => env('SWEET_ALERT_ANIMATION_SHOW_CLASS', 'animated fadeInDown faster'),
'hideClass' => env('SWEET_ALERT_ANIMATION_HIDE_CLASS', 'animated fadeOutUp faster'),
'enable' => env('SWEET_ALERT_ANIMATION_ENABLE', false),
],

'animatecss' => env('SWEET_ALERT_ANIMATECSS', 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.2/animate.min.css'),
'animatecss' => env('SWEET_ALERT_ANIMATECSS', 'https://cdn.jsdelivr.net/npm/animate.css'),

/*
|--------------------------------------------------------------------------
Expand Down

0 comments on commit 084f265

Please sign in to comment.