HTML element does not fade in using jquery

六月ゝ 毕业季﹏ 提交于 2019-12-01 11:34:06

The CSS transitions that you have applied to every element on the page (very beginning of your css/main.css):

* {
    transition: all .1s linear;
    -webkit-transition: all .1s linear;
    -moz-transition: all .1s linear;
    -o-transition: all .1s linear;
}

are clashing with the jQuery fade animation.

Remove the CSS transitions from your button using something like:

.bigBtn {
    transition: none;
    -webkit-transition: none;
    -moz-transition: none;
    -o-transition: none;
}

(Or better still, only apply them where you want them in the first place).

Your .fadeIn('slow') will then work.

$('.add').on('click',function(){
    var items = $('.items > h2').length;
    if(items >= 2) {
       $('.bigBtn').fadeIn('slow');
    }
});
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!