AI Verified

Name

Content Animate

About

this complete script imports the animation script and then adds custom animations all over the content.

Language

PHP

Rating

Voted: 0 by 0 user(s)

Codevault

MyCloudWorld

Scroll down to see more snippets from this codevault.

Wordpress Compatability

The author has indicated that this snippet is compatable up to wordpress version: Not Specified

Our AI bot has checked this snippet is compatable up to wordpress version: 6.1

Code Snippet Plugin Sync

Free & Pro

Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.

Pro Only (Coming Soon)

You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.

Website/ Profile URL:

https://mycloudworld.com

History

Last modified:

12/11/2022

Important Note

This snippet has the following status:

AI Verified

This snippet has been tested by our AI bot, see any comments below.

AI Bot Comments:

Found 0 vulnerabilities

Content Animate

 
                    
1function mcw_animation_scripts() {
2 wp_enqueue_script( 'jquery' );
3 wp_enqueue_style( 'animate-style', '//cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css' );
4}
5add_action( 'wp_enqueue_scripts', 'mcw_animation_scripts' );
6 
7add_action('wp_head', function(){ ?>
8<style>
9 .entry-content p, .entry-content h1, .entry-content h2, .entry-content h3, .entry-content h4, .entry-content h5, .entry-content h6, .site-footer p, .site-footer h2, .site-footer h3, .site-footer h4, .site-footer h5, .site-footer h6, .site-footer a.gb-button-text {
10 opacity: 0;
11 }
12</style>
13<script>
14 var animate = 'animate__animated';
15 var animation = ['animate__bounce', 'animate__backInUp', 'animate__bounceIn', 'animate__bounceInUp', 'animate__fadeInUp', 'animate__fadeInDown', 'animate__flipInX', 'animate__flipInX', 'animate__slideInUp'];
16 //var animation = ['animate__slideInLeft', 'animate__slideInRight'];
17 document.documentElement.style.setProperty('--animate-duration', '2s');
18 jQuery(document).ready(function($){
19 $('.entry-content p, .entry-content h1, .entry-content h2, .entry-content h3, .entry-content h4, .entry-content h5, .entry-content h6, .site-footer p, .site-footer h2, .site-footer h3, .site-footer h4, .site-footer h5, .site-footer h6, .site-footer a.gb-button-text').each(function(){
20 $(this).addClass(animate);
21 //$(this).addClass(animation[randomnumber]);
22 });
23 $('.animate__animated').each(function() {
24 if (isScrolledIntoView(this) === true) {
25 if( $(this).hasClass('added') ){}
26 else{
27 var randomnumber = Math.floor(Math.random() * animation.length);
28 //$(this).addClass(animation[randomnumber]);
29 $(this).addClass('animate__fadeInUp');
30 $(this).addClass('added');
31 }
32 }
33 });
34 // Check if element is scrolled into view
35 function isScrolledIntoView(elem) {
36 var docViewTop = $(window).scrollTop();
37 var docViewBottom = docViewTop + $(window).height();
38 
39 var elemTop = $(elem).offset().top;
40 var elemBottom = elemTop + $(elem).height();
41 
42 return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
43 }
44 // If element is scrolled into view, fade it in
45 $(window).scroll(function() {
46 $('.animate__animated').each(function() {
47 if (isScrolledIntoView(this) === true) {
48 if( $(this).hasClass('added') ){}
49 else{
50 var randomnumber = Math.floor(Math.random() * animation.length);
51 $(this).addClass('animate__fadeInUp');
52 $(this).addClass('added');
53 }
54 }
55 });
56 });
57 });
58</script>
59<?php }, 999);

0

Related Snippets

Please see some snippets below related to this snippet..

Animation

Unverified

0

working model of daynight toggle with js

Added: 6 months ago

Last Updated: 6 months ago

Animation

Unverified

1

Subtile Loop Animation from Left to Right

Added: 1 year ago

Last Updated: 1 year ago

Subtile Loop Animation from Left to Right

Animation

Unverified

0

working model of daynight toggle with checkbox

Added: 6 months ago

Last Updated: 6 months ago

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

General

AI Verified

6

Remove Google Fonts and Use System Fonts

Added: 2 years ago

Last Updated: 2 months ago

Use this hook to remove all Google Fonts from website and use system fonts for best CLS Score.

WooCommerce

AI Verified

4

WooCommerce Hide Coupon Form after apply

Added: 2 years ago

Last Updated: 1 year ago

WooCommerce hide coupon form after coupon is applied.

WordPress Admin

AI Verified

2

Image Size Upload Set To Full Default

Added: 2 years ago

Last Updated: 1 year ago

If you want to set the image size to full-width for use in the post editor permanently.