所以我才开始学习,所以我是初学者。我想要实现的是改变具有不同背景的 div,比如这里。在教程中完成了,但我想用背景属性来做,因为我不希望我的图像是可拖动的。
发生的情况是,不是每个图像相互流动并改变颜色,而是发生了一些白光。有什么帮助吗?
这是HTML
<p id="transitionControls">
<span>Snap1</span>
<span>Snap2</span>
<span>Snap3</span>
<span>Snap4</span>
<span>Snap5</span>
<span>Snap6</span>
<span>Snap7</span>
</p>
<div id="imageContainer" class='opaque'>
<div id="Snap7" class="snap"></div>
<div id="Snap6" class="snap"></div>
<div id="Snap5" class="snap"></div>
<div id="Snap4" class="snap"></div>
<div id="Snap3" class="snap"></div>
<div id="Snap2" class="snap"></div>
<div id="Snap1" class="snap"></div>
</div>
这是CSS:
div{
position:absolute;
-webkit-transition: opacity 1s ease-in-out;
-moz-transition: opacity 1s ease-in-out;
-o-transition: opacity 1s ease-in-out;
background-size: 100% 100%;
margin:auto;
transition: opacity 1s ease-in-out;
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
}
div.snap {
opacity:0;
}
div.opaque{
opacity:1;
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
filter: alpha(opacity=1);
}
每个 Snap 都有简单的 CSS
#Snap1 {
background: url('img/Snap_1.jpg') no-repeat;
width: 1680px;
height: 1350px;
}
这是飞镖脚本
import 'dart:html';
DivElement div;
var counter = 0;
void main() {
query("#transitionControls")
..onClick.listen(changeDiv);
}
//
void changeDiv(MouseEvent event) {
SpanElement snap = event.target;
var text = snap.text;
div = query(".opaque");
query("#$text").classes.add("opaque");
div.classes.remove("opaque");
}