* Toggle the grid animation state. Toggles the `grid-stack-animate` class. * @param doAnimate if true the grid will animate. * @param delay if true setting will be set on next event loop.
(doAnimate = this.opts.animate, delay?: boolean)
| 1445 | * @param delay if true setting will be set on next event loop. |
| 1446 | */ |
| 1447 | public setAnimation(doAnimate = this.opts.animate, delay?: boolean): GridStack { |
| 1448 | if (delay) { |
| 1449 | // delay, but check to make sure grid (opt) is still around |
| 1450 | setTimeout(() => { if (this.opts) this.setAnimation(doAnimate) }); |
| 1451 | } else if (doAnimate) { |
| 1452 | this.el.classList.add('grid-stack-animate'); |
| 1453 | } else { |
| 1454 | this.el.classList.remove('grid-stack-animate'); |
| 1455 | } |
| 1456 | this.opts.animate = doAnimate; |
| 1457 | return this; |
| 1458 | } |
| 1459 | |
| 1460 | /** @internal */ |
| 1461 | private hasAnimationCSS(): boolean { return this.el.classList.contains('grid-stack-animate') } |
no test coverage detected