我阅读了每个线程并尝试了所有可能的解决方案,但不知道我错过了什么!
我有一个 div video_container_dc
,当我用 Javascript 调用它时,我想淡入它。
CSS:
#video_container_dc {
position: absolute;
width: 350px;
height: 198px;
top: 0px;
left: 376px;
opacity: 0;
/*visibility:hidden;*/
/*display:none;*/
}
#video_container_dc.expandingVid {
-webkit-transition: all 2s ease-out 1s;
-moz-transition: all 2s ease-out 1s;
-o-transition: all 2s ease-out 1s;
-ms-transition: all 2s ease-out 1s;
transition: all 2s ease-out 1s;
opacity:1;
/*visibility:visible;*/
/*display:block;*/
}
JAVASCRIPT:
var expand_content;
var vidContainer;
var expandTweens = [];
function expand_transition() {
expandTweens = [];
expand_content.className = 'expanding';
vidContainer.className = 'expandingVid';
}
inits = function () {
expand_content = document.getElementById('expand_content_dc');
vidContainer = document.getElementById('video_container_dc');
}
我为补间函数尝试了所有这些都无济于事:
//vidContainer = document.getElementById('video_container_dc');
//document.getElementById( 'video_container_dc' ).className += 'expandingVid';
//vidContainer.className += "expandingVid";
//vidContainer.css("opacity", 0);
//vidContainer.offset();
//vidContainer.css("transition", "opacity 1000ms ease-out").css("opacity", 1);
HTML:
首先我inits();
在 html 中运行,然后:
<div id="video_container_dc">
<video id="video_dc" >
<source id="video_1_mp4_src_dc" type="video/mp4"/>
</video>
</div>