简体   繁体   English

我如何使用jQuery将隐藏元素从0不透明度滑动到1

[英]how can i slideDown A Hidden element from 0 opacity to 1 with jquery

i have a coke like below that using jquery prototype Library: 我有一个像下面这样的可乐,使用jQuery原型库:

        new Effect.SlideDown(this.imageDataContainer, { sync: true, duration: this.resizeDuration, from: 0.0, to: 1.0 }), 
        new Effect.Appear(this.imageDataContainer, { sync: true, duration: this.resizeDuration }) 

this code force the imageDataContainer element to sliding Down From 0 Opacity To 1 Opacity. 此代码强制imageDataContainer元素从0不透明度向下滑动到1不透明度。

how can i implement upper codes with new downloaded jquery library from jquery.com web site? 我如何使用jquery.com网站上新下载的jquery库实现较高代码?

the syntax of slideDown is like this : http://www.w3schools.com/jquery/eff_slidedown.asp slideDown的语法如下: http : //www.w3schools.com/jquery/eff_slidedown.asp

i know how slideDown And fadeTo Functions Work in jquery / but how can i combine them like the upper codes? 我知道slideDown和fadeTo函数如何在jquery中工作,但是如何将它们像上层代码一样组合?

i test the below code - but u can not changing the opacity - - DURING - - toggle : 我测试了以下代码-但您无法更改不透明度-- 期间 --切换:

          $('#lightbox-container-image-data-box').animate({
            opacity: 0,
            height: 'toggle',
            opacity: 1
          }, 400, function() {
            // Animation complete.
          });

thanks 4 attention 谢谢4注意

Use animate() for that. 为此使用animate() With animate you can animate any arbitrary number of properties on an element. 使用动画,您可以为元素上的任意数量的属性设置动画。

Check a demo of the code below here: http://jsfiddle.net/chrisramakers/8ewEp/ 在此处查看以下代码的演示: http : //jsfiddle.net/chrisramakers/8ewEp/

$('#book').hide();
$('#book').animate({
  opacity: 'toggle',
  height: 'toggle'
});

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

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