ska-dev
Forum Replies Created
-
Forum: Plugins
In reply to: [Animations for Blocks] Customize Animation distanceHello, thanks for the suggestion.
Would it be possible to have an additional setting in the UI to customize the value directly from the editor?
Yeah it might be possible, I’ll look into it when I get a chance.
Forum: Plugins
In reply to: [Animations for Blocks] Ease in or out txt jumpsLooks like there is a conflict with the “Stackable – Page Builder Gutenberg Blocks” plugin.
You have the animation applied to the plugins’ “Heading” block, which has CSS:
transition: var(--stk-transition-default);which overrides the AOS CSS:
transition-timing-function: ease-in;making the animation not work properly.
To work around it you can insert the Animation container block, put the Heading block inside of it but remove the animation from the Heading block and apply the animation on the Animation container block instead.
So instead of:
- Heading – Fade Animation
you should have:
- Animation container – Fade animation
- Heading – No animation
Let me know if that makes sense.
Forum: Plugins
In reply to: [Animations for Blocks] New feature ideaability to add custom animations with your own CSS code
You can kind of achieve it by overriding the existing animations.
Add CSS to the Site editor -> Styles -> Additional CSS:
[data-aos="fade-left"]:not(#_).reveal {
clip-path: inset(0 100% 0 0);
transform: none;
transition-property: opacity, clip-path;
}
[data-aos="fade-left"]:not(#_).reveal.aos-animate {
clip-path: inset(0 0 0 0);
}(or you can add the custom CSS to some other location, the
:not(#_)part is to increase specificity, you can also use!important)Then set a block’s animation to Fade -> Fade left and add a custom class name to the block – “reveal” (under Advanced -> Additional CSS class(es)).
This overrides the “Fade left” animation to the clip-path animation when the block has the
.revealclass –- you don’t need to add
opacitybecause the Fade animation already animates opacity from 0 to 1 - you don’t need
transition-durationbecause it can use the value from the Animation -> Duration option - you don’t need
transition-timing-functionbecause the Animation -> Advanced settings -> Easing can specify it
Forum: Plugins
In reply to: [Animations for Blocks] Lenis Scroll and FancyboxIs it possible to disable Lenis for this page only?
Yes, you can use the following snippet in your child theme’s
functions.php, replace the123with the ID of the page you want to disable Lenis on:add_action('wp', function() {
$disable_lenis = is_singular() && get_the_ID() === 123;
if($disable_lenis) {
add_filter('option_animations-for-blocks', function($value) {
$value['lenis'] = 'off';
return $value;
});
}
});I open a Fancybox pop-up with HTML content and a scroll bar in this pop-up.
The scroll bar no longer works; I think Lenis is capturing the scroll.Lenis itself has workarounds for this also: https://github.com/darkroomengineering/lenis?tab=readme-ov-file#considerations
So you should be able to fix it if you are able to add a
data-lenis-preventattribute to the scrollable content element in the pop-up or you can try by modify the Lenis JS config by assigning thewindow.anfbLenisSettingsJS variable:add_action('wp_enqueue_scripts', function() {
wp_add_inline_script(
'anfb/lenis',
"window.anfbLenisSettings = { autoRaf: true, prevent: node => !!node.closest('.fancybox__dialog') };",
'before'
);
});Forum: Plugins
In reply to: [Animations for Blocks] The plugin stopped workingYeah I will probably add some option to override the
prefers-reduced-motion: no-preferencein the next update, some time in the near future.animations stopped working for me too
Just to clarify, they didn’t stop working, they are working as intended, you don’t see them because you prefer to not see the animations. This is your personal system preference, other users who don’t have it enabled will still see animations. But I will make it more clear and add a toggle as well.
Forum: Plugins
In reply to: [Animations for Blocks] The plugin stopped workingThe animations on your test site work for me, so you also probably have prefers reduced motion enabled on your computer.
I’m not sure why the snippet isn’t having an effect for you though.
But it’s recommended to turn prefers-reduced-motion setting off rather than use the snippet – ask an AI how to do it, it will give you different places to check, depending on your OS and browser. It could also be enabled in Chrome dev tools: https://i.imgur.com/SpnclNP.png
Add this snippet to a Custom HTML block on any page, it will tell you whether the setting is on or off:
<style>
.test-notice {
padding: 1rem;
margin-block: 1rem;
color: white;
border-radius: 4px;
display: none;
}
@media (prefers-reduced-motion: reduce) {
.test-notice[data-enabled=true] {
display: block;
background-color: red;
}
}
@media (prefers-reduced-motion: no-preference) {
.test-notice[data-enabled=false] {
display: block;
background-color: green;
}
}
</style>
<div class="test-notice" data-enabled="true">Reduced motion is enabled, animations won't play.</div>
<div class="test-notice" data-enabled="false">Reduced motion is not enabled, animations will play.</div>Here’s another PHP snippet (for child theme’s
functions.php) that can change the plugin’s default behavior though:add_action('init', function() {
if(defined('WSD_ANFB_AOS_HANDLE')) {
wp_deregister_style(WSD_ANFB_AOS_HANDLE);
wp_register_style(
WSD_ANFB_AOS_HANDLE,
plugins_url('build/aos.css', WSD_ANFB_FILE),
[],
WSD_ANFB_VER,
'screen' // Override 'screen and (prefers-reduced-motion: no-preference)'
);
}
}, 11);Forum: Plugins
In reply to: [Animations for Blocks] The plugin stopped workingIs there a way to keep my system animation effects off, and still have the animation in the browser working?
Yes, you would need to add this custom code (to your child theme’s
functions.php, a mu-plugin, snippet, etc):add_action('wp_enqueue_scripts', function() {
if(defined('WSD_ANFB_AOS_HANDLE') && wp_style_is(WSD_ANFB_AOS_HANDLE, 'enqueued')) {
// Override 'screen and (prefers-reduced-motion: no-preference)'
wp_styles()->registered[WSD_ANFB_AOS_HANDLE]->args = 'screen';
}
});Forum: Plugins
In reply to: [Animations for Blocks] The plugin stopped workingLooks like it’s working to me.
Does your browser/device perhaps have
prefers-reduced-motionenabled? In which case the the animations won’t play.That’s a good point, thanks!
Added in version 1.2.3.
Forum: Plugins
In reply to: [Animations for Blocks] Incorrect use of label for=FORM_elementThanks, should be fixed in latest version.
Forum: Plugins
In reply to: [Animations for Blocks] Undefined array warning printed on Woo shop pageCan you try this change: https://github.com/ska-dev-1/animations-for-blocks/commit/47dc7f8e7cae66eb04838b1d7ff2412063dd7a0f
(edit the plugin file manually, just add the?? []on L675)If it works, then I’ll include it in the next plugin update.
Forum: Plugins
In reply to: [Animations for Blocks] Fade on hero image not working on front endI think it’s happening because some optimization plugin is moving the
aos.cssfile to the end of the body, so it fails applying the initialopacity: 0CSS rule to the element before it has rendered, so the element appears as visible, then tries to fade out (which now takes 1.7s due to the animation duration), and then the animation is triggered and it has to fade in again, so it just ends up doing an awkward flicker.You can try to exclude
aos.cssfrom being moved away from the<head>and make it render-blocking, or if you don’t want it to be render-blocking you could try to manually applyopacity: 0to the element so that it starts from this state.Forum: Plugins
In reply to: [Animations for Blocks] Fade on hero image not working on front endCan’t really say without seeing it live. Perhaps that image has some other CSS applied to it that interferes with the animation?
It shouldn’t be an issue that the element is at the top of the page.
Forum: Plugins
In reply to: [Animations for Blocks] Reversed animationAnimation happens when the element is scrolled into view. If you enable Advanced settings -> Mirror, then reverse animation will happen when scrolling past it.
To animate out while the element is still in view you would need to manually remove the
aos-animateclass from the element with JavaScript.All the animation are made to appears, unfortunately, none to disappears.
That is true, for example this is the CSS for the fade animation:
html:not(.no-js) [data-aos^=fade][data-aos^=fade] {
opacity: 0;
transition-property: opacity, transform;
}
html:not(.no-js) [data-aos^=fade][data-aos^=fade].aos-animate {
opacity: 1;
transform: none;
}If you were to add custom CSS to reverse the opacity:
html:not(.no-js):not(#_) [data-aos^=fade][data-aos^=fade] {
opacity: 1;
}
html:not(.no-js):not(#_) [data-aos^=fade][data-aos^=fade].aos-animate {
opacity: 0;
}then I it would animate and disappear, but overall the AOS library is not well suited for it. But what it essentially does is add the
aos-animateclass to the element when it’s in view and remove it when it’s no longer in view (with “mirror” enabled), so with custom CSS you technically can target specific elements to animate however you like based on that. At that point it’s probably better to use GSAP or something though.Forum: Plugins
In reply to: [WooCommerce] Stock Update IssueI believe the issue to be Facebook for WooCommerce, specifically this change:
https://github.com/facebook/facebook-for-woocommerce/commit/ce0eec5811d3d88d37c9fc558f7cd1d1eb26da47
Notice how when you initially open the product variations, the “Save changes” button is not disabled, even though no changes have been made yet, and also after saving it doesn’t become disabled. The change event triggered by FB for WC is causing the variations to become dirty and cause multiple saves with race conditions or something like that.
If OP can try to replicate what they did in the video while the FB for WC plugin is disabled, it should confirm or deny this.