11/*
22 * animate.js - animate-dynamic.ga
3- * Version - v2.13.5
3+ * Version - v2.16.7
44 * Licensed under the MIT license - https://opensource.org/licenses/MIT
55
66 * Copyright (c) 2021 Mohammed Khurram (KodingKhurram)
@@ -36,6 +36,7 @@ $(document).keyup(function(e){
3636function aniUtil_dramatic ( ) {
3737 //This function initializes element for dramatic animations
3838 $ ( ".aniUtil_dramatic" ) . each ( function ( ) {
39+ $ ( this ) . css ( "opacity" , 100 ) ;
3940 if ( ! $ ( this ) . hasClass ( "aniUtil_disabled" ) && ! $ ( this ) . hasClass ( "animate__animated" ) ) {
4041 $ ( this ) . css ( "opacity" , 0 ) ;
4142 }
@@ -210,6 +211,27 @@ function hover_Animations(){
210211 $ ( this ) . css ( "opacity" , 100 ) ;
211212 }
212213 $ ( this ) . addClass ( ani_classes ) ;
214+ if ( $ ( this ) . hasClass ( "aniUtil_onMouseRepeat" ) ) {
215+ //Add repeat class
216+ $ ( this ) . addClass ( "animate__infinite" ) ;
217+ }
218+ else if ( $ ( this ) . hasClass ( "aniUtil_active" ) ) {
219+ this . addEventListener ( 'animationend' , ( ) => {
220+ $ ( this ) . removeClass ( ani_classes ) ;
221+ if ( $ ( this ) . hasClass ( "aniUtil_dramatic" ) ) {
222+ $ ( this ) . css ( "opacity" , 0 ) ;
223+ }
224+ } ) ;
225+ }
226+ else {
227+ $ ( this ) . removeClass ( "aniUtil_onMouse" ) ;
228+ }
229+ }
230+ } ) ;
231+ $ ( this ) . mouseout ( function ( ) {
232+ //functional requirement for aniUtil_onMouseRepeat
233+ if ( $ ( this ) . hasClass ( "aniUtil_onMouseRepeat" ) ) {
234+ $ ( this ) . removeClass ( "animate__infinite" ) ;
213235 if ( $ ( this ) . hasClass ( "aniUtil_active" ) ) {
214236 this . addEventListener ( 'animationend' , ( ) => {
215237 $ ( this ) . removeClass ( ani_classes ) ;
@@ -220,6 +242,7 @@ function hover_Animations(){
220242 }
221243 else {
222244 $ ( this ) . removeClass ( "aniUtil_onMouse" ) ;
245+ $ ( this ) . removeClass ( "aniUtil_onMouseRepeat" ) ;
223246 }
224247 }
225248 } ) ;
@@ -336,6 +359,7 @@ function key_Animations(e){
336359//get animation class
337360function get_aniClasses ( elem ) {
338361 //This function returns the animate.css animation classes for the element
362+ elem = $ ( elem ) [ 0 ] ;
339363 var ani_classes = '' ;
340364 var classname = elem . classList ;
341365 $ ( classname ) . each ( function ( ) {
@@ -620,6 +644,8 @@ function aniUtil_disable(which){
620644 $ ( this ) . addClass ( "aniUtil_disabled" ) ;
621645 } ) ;
622646 }
647+ //Re-initializing dramatic animations
648+ aniUtil_dramatic ( ) ;
623649}
624650
625651//aniUtil_enable()
@@ -704,6 +730,8 @@ function aniUtil_enable(which){
704730 $ ( this ) . removeClass ( "aniUtil_disabled" ) ;
705731 } ) ;
706732 }
733+ //Re-initializing dramatic animations
734+ aniUtil_dramatic ( ) ;
707735}
708736
709737//aniUtil_animate()
@@ -713,8 +741,11 @@ function aniUtil_animate(elem, ani_Class){
713741 $ ( elem ) . removeClass ( 'aniUtil_disabled' ) ;
714742 }
715743 $ ( elem ) . addClass ( ani_Class ) ;
744+ if ( ! $ ( elem ) . hasClass ( "aniUtil_onClick" ) && ! $ ( elem ) . hasClass ( "aniUtil_onMouse" ) )
716745 view_Animations ( ) ;
746+ if ( $ ( elem ) . hasClass ( "aniUtil_onClick" ) )
717747 click_Animations ( ) ;
748+ if ( $ ( elem ) . hasClass ( "aniUtil_onMouse" ) )
718749 hover_Animations ( ) ;
719750}
720751
@@ -723,3 +754,12 @@ function aniUtil_inanimate(elem){
723754 //This function inanimates/disables the animation for a perticular element
724755 $ ( elem ) . addClass ( 'aniUtil_disabled' ) ;
725756}
757+
758+ //aniUtil_reset()
759+ function aniUtil_reset ( elem ) {
760+ //This function resets the animation for a perticular element
761+ var reset_classes = get_aniClasses ( elem ) ;
762+ $ ( elem ) . removeClass ( reset_classes ) ;
763+ if ( ! $ ( elem ) . hasClass ( "aniUtil_onMouse" ) && ! $ ( elem ) . hasClass ( "aniUtil_onClick" ) && ! $ ( elem ) . is ( '[class*="aniCus_onKey"]' ) )
764+ view_Animations ( ) ;
765+ }
0 commit comments