小编Bil*_*khi的帖子

更改CSS高度属性时jQuery添加动画

我希望你们都过得愉快

我想为这段代码添加动画.我尝试使用animate().但它没有用,也许是因为我缺乏javascript的知识.

请告诉我这段代码是否可行,或者我是否需要尝试别的东西?你有什么建议?

非常感谢你提前.

这是HTML代码:

<div id="description_wrapper">
    Text content.<br/>
    See; More Text content.
</div>

<button class="learn_more" id="lm_more" href="#">Learn more</button>
Run Code Online (Sandbox Code Playgroud)

CSS

#description_wrapper
{
    margin: 0 auto;
    margin-top: 25px;
    height: 0;
    overflow: hidden;
}
Run Code Online (Sandbox Code Playgroud)

jQuery

$('#lm_more').click(function(event){
    event.preventDefault();
    if($('#description_wrapper').css('height') > '1px') {
        $('#description_wrapper').css({'height': '0px'});
        $('#lm_more').html('Learn More');
    }
    else
    {
        $('#description_wrapper').css({'height': 'auto'});
        $('#lm_more').html('Learn less');
    }
});
Run Code Online (Sandbox Code Playgroud)

在这里查看代码 http://jsfiddle.net/Gbspx/11/

css jquery jquery-animate

5
推荐指数
2
解决办法
1万
查看次数

CSS3 过渡边框半径问题(悬停时延迟)

我面临 CSS 转换问题,“仅使用边框半径”

基本上我想对边框进行动画处理,问题是当我将鼠标悬停时,需要一秒钟才能开始动画处理。我尝试将延迟设置为0,但没有成功。

那么这是一个常见问题吗?如果有解决方案请告诉我。如果没有,还有什么其他方法可以做到这一点?

这是我的例子:小提琴

一些 HTML 代码:

<a href=""><span  class="icon"><p>A</p></span></a>
<a href=""><span class="icon"><p>B</p></span></a>
<a href=""> <span class="icon"><p>C</p></span></a>
<a href=""> <span class="icon"><p>D</p></span></a>
Run Code Online (Sandbox Code Playgroud)

谢谢大家

html css css-transitions

0
推荐指数
1
解决办法
5107
查看次数

标签 统计

css ×2

css-transitions ×1

html ×1

jquery ×1

jquery-animate ×1