Animations for Blocks

توسط

Lightweight plugin that adds additional inspector controls to block editor blocks that allow to animate the block once it becomes visible to the user during scrolling. The controls can be used to select an animation type (fade, flip, slide, zoom), variation (different directions), as well as delay, duration and more advanced settings. Upon changing an option the animation can be immediately previewed in the editor.

Demo

This plugin uses AOS – Animate on scroll library and adds its’ stylesheet (2.8 kB) and script (5.2 kB) to the front end as well as a script that initializes the animations (1.3 kB).

Install via admin dashboard

  1. Go to your WordPress admin dashboard -> Plugins.
  2. Click “Add New”.
  3. Click “Upload Plugin”.
  4. Select the animations-for-blocks.zip file.
  5. Click “Install Now”.
  6. Activate the plugin from WordPress admin dashboard -> Plugins.

Manual install via FTP upload

  1. Upload the folder “animations-for-blocks” from animations-for-blocks.zip file to your WordPress installations ../wp-content/plugins folder.
  2. Activate the plugin from WordPress admin dashboard -> Plugins.

سوالات متداول

How do I add an animation?

In your selected block’s inspector controls (block settings) open the “Animation” panel and select an animation. The current block should display a preview of the selected animation and further options related to that animation will become available below.

How does it work?

Animations for Blocks plugin works by using the Animate on Scroll (AOS) library that is mostly CSS-based with some JavaScript to handle initialization. The plugin adds attributes to block’s root element that tell the AOS library how to animate it. Loading the necessary styles and scripts is also handled automatically by the plugin.

Animations are not playing for me

By default the plugin will not play animations for users that have the “prefers-reduced-motion” setting enabled for their device. This functionality can be turned off by enabling the “Ignore reduced motion preference” plugin option, how ever it’s not recommended. Other users that don’t have reduced motion preference enabled will still see the animations.

Animations cause a horizontal scrollbar

Since some elements are initially placed off-screen to then animate back to their normal position it can cause a scrollbar to appear. To prevent this the overflow should be hidden on one of the parent elements. Which element you should target is specific to your site. For example, you can try adding custom CSS: .wp-site-blocks { overflow: hidden; }, but you have to make sure that this doesn’t break any other features on your site that require overflow being visible.

Does it work for all blocks?

It should work with normal blocks that render a valid WP Element that can utilize the blocks.getSaveContent.extraProps filter as well as dynamic blocks that utilize a render_callback. Third party blocks that do something unorthodox may not work.
Known unsupported blocks

Disable block support

The anfb_unsupported_blocks filter can be used in your child theme’s functions.php file to disable block animation support.

add_filter('anfb_unsupported_blocks', function($blocks) {
    $blocks[] = 'core/button';
    return $blocks;
});

What happens when I disable this plugin?

After disabling this plugin blocks with animations can become invalid. From there you can attempt to recover the block by clicking “Attempt Block Recovery” which should remove the custom animation attributes. If you don’t want to risk blocks becoming invalid you need to disable all animations before disabling the plugin.

All the animated elements are invisible on the front end

When none of the animated elements show up on your site it’s possibly due to a JavaScript error preventing the initialization of AOS. Please open the Developer Tools (F12 on Chrome/Firefox) and look for any errors in the Console tab. You can contact support with the error message, include your site link if possible.

×
نظری برای این آیتم موجود نیست.
0 0 رای ها
امتیازدهی
اشتراک در
اطلاع از
0 نظرات
قدیمی‌ترین
تازه‌ترین بیشترین رأی
بازخورد (Feedback) های اینلاین
مشاهده همه دیدگاه ها
نسخه حجم فایل SHA256 تغییرات دانلود
1.2.5 47 کیلوبایت -
دانلود
×
★★★★★
★★★★★
4.8 /5 (27 نظر)

قیمت:

رایگان

نگارش

1.2.5

آخرین انتشار

10 اردیبهشت 1405

آخرین بروزرسانی

2 ماه پیش

نصب های فعال

10,000+

نگارش وردپرس

وردپرس 6.6+

تست شده از نسخه

وردپرس 6.9.4

نگارش PHP

PHP 8.1+

نسخه ها

1 نسخه