给div加一个移入后显示渐变色,但是transition过渡效果缺没生效

问题如题:

代码如下:

html:


<div class="box"></div>

css:


.box{

    width: 100px;

    height:100px;

    background: #fff;

    -webkit-transition: all 0.4s cubic-bezier(.4,0,.2,1) 0s;

    -moz-transition: all 0.4s cubic-bezier(.4,0,.2,1) 0s;

    -ms-transition: all 0.4s cubic-bezier(.4,0,.2,1) 0s;

    -o-transition: all 0.4s cubic-bezier(.4,0,.2,1) 0s;

    transition: all 0.4s cubic-bezier(.4,0,.2,1) 0s;

}

.change {

    background: -webkit-gradient(linear, 0 0, 100% 100%, from(#6E45E2),to(#88D3CE));

}

js代码如下:


$('.venueModel').on('mouseover',function () {

    $(this).addClass('change');

}).on('mouseleave',function () {

    $(this).removeClass('change');

});


其中:transition没生效。。。求解!在线等!急!


守着一只汪
浏览 1360回答 3
3回答

慕斯709654

渐变和transition不能同时用吧

阿晨1998

.....我觉得楼上好像没说到重点.....你先弄清楚transition变的当然是同一属性的样子咯。background: #fff&nbsp;等价于&nbsp;background-color: #fffbackground: -webkit-gradient(linear, 0 0, 100% 100%, from(#6E45E2),to(#88D3CE));&nbsp;等价于&nbsp;background-image: -webkit-gradient(linear, 0 0, 100% 100%, from(#6E45E2),to(#88D3CE));它们并不是同一属性,transition没有用不是很正常吗?
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript