简体   繁体   English

jQuery替换缓动和动画

[英]jquery replace easing and animation

I've been playing with the easing on a menu so long that it is making me dizzy. 我一直在玩菜单上的放松,这让我感到头晕。 I have a menu and when you click on it, it eases the associated content into view. 我有一个菜单,当您单击它时,它将使相关内容易于查看。 I'm not sure what search terms to use to have the element just appear instead of ease. 我不确定要使用什么搜索字词来使该元素出现而不是简单。 Instead of animating from -1000px to 0px, just go directly from one to another. 无需从-1000px到0px进行动画处理,只需直接从一个动画过渡到另一个动画即可。

Here is the code I have been using from CODROPS 这是我从CODROPS使用的代码
I'm trying to modify or replace it so the page doesn't ease into view it just blinks into existence. 我正在尝试修改或替换它,因此该页面无法轻松进入页面,它只是一闪而过。

     if(idx > current){
                            $current.stop().animate({'top':'-1000px'},600,'linear',function(){
                                $(this).css({'top':'310px'});
                            });
                            $next.css({'top':'1000px'}).stop().animate({'top':'5px'},600,'linear');
                        }  
/* UP THE LIST */       else if(idx < current){
                            $current.stop().animate({'top':'1000px'},600,'linear',function(){
                                $(this).css({'top':'1000px'});
                            });
                            $next.css({'top':'-1000px'}).stop().animate({'top':'5px'},600,'linear');
                        }

如果您不想动画,则可以只对新元素进行hide()show() ,也可以直接更改它们的height()width() (取决于元素所处的先前状态)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM