So when writing code such as $W(“#element”).show(“fadein”) or .hide(“fadeout”), is there any way I can customize the duration/speed of animation and its delay or direction attributes?
I tried searching for this both in this forum and on the API docus but my keywords did not snag a thing.
Hi Omid, just half of a solution, but may be enough:
Use the editor animation panel for setting the ‘fade in’ animation with desired delay and duration.
Then, in code, just call ‘show()’ with no parameter.
Seem like it can’t be done for ‘fade out’ at the moment.
Ah, yes, this does seem to actually work. I also noticed items permanently displayed on all pages seem to have the option for “animate for first time only” checked and disabled by default, is there a good reason for that enforcement you can share here while we are on this topic? Otherwise, would you please kindly share my feedback that such enforcement is just not very user friendly nor understandable if one has needs for repeated reanimation of items per HOVER and other Code based and more advanced functions?
Ah, yes, please consider this for feature developments in this regard. I also am using these functions for a header that only appears upon scroll, but I have no control over the speed with which fade in and fade out occurs as this is a STRIP! and there are no regular animation controls, for even the earlier referenced half measure in this case! Bummer.
Hey guys, I’m stuck here, help somebody?
So I’m trying to have my menu slide in and out, the menu is a container box with my menu attached to it, inside the box. The box is called #box1
I have a square shape with a menu hamburger icon in it called #shape5
So what I’m trying to do is:
Menu SLIDES IN when mouse hovers a shape and
Menu SLIDES OUT when mouse exits the container box
And here is my code:
export function shape5_onMouseIn(event, $w) {
$w(“#box1”).show(“slideIn”);
}
export function box1_onMouseOut(event, $w) {
$w(“#box1”).hide(“slideOut”);
}
Although the menu slides in very well when I hover shape, when OnMouseOut occurs, the menu doesn’t slide out, it just disappears, without any animation. Poof… no slick slide out.
Anyone knows how to fix this?
The SlideIn shows and SlideOut doesn’t, may be because the SlideIn must have been set already from the editor animation panel, as it only affects the “In” animations.
This page has all the animations and their exact name:
I am also trying to apply the show (“SlideIn”) and show (“SlideOut”) function, however I would like to choose the direction of the animation. I know you can choose the direction by clicking on Animation and customizing. But even by inserting the code in the onMouseOut property the object simply disappears, not applying the selected effect. How to solve this, because if in show () it was possible to choose the direction, this would be much simpler and the problem would be solved.
Has anyone been through this and managed to solve it?
Is it that you’re using $w(‘#yourelement’).show() for both the SlideIn and SlideOut effect? If so, consider using the .hide(“SlideOut”) function instead for the removal of your element onMouseOut. I’m guessing though that you may have made a typo, or I’m not understanding clearly.
I wasn’t able to get the direction for my SlideOut animation either unfortunately, Wix code currently doesn’t support the option.
The new feature looks great!! I had a look at the reference document, and I like the new options parameter. I’ll test them out soon to see if they’re truly as good as advertised.
I’m trying the use following code for animation control using EffectOptions for the first time. But its not working can someone please let me know what is wrong with this code.