I want to scroll some text over an image in transition. I can't use an image in background because transition dosn't work. I thought to use one div (fixed) for the image and one for the text to scroll over it.
I can't use z-index because dosn't work... Is there another way?
#main {
width: 100%;
}
#imagePlayerDiv {
height:calc(100vh * 0.6);
width: 100%;
}
#imagePlayerDiv img{
animation: scaleImgEffect 60s alternate infinite;
height: calc(100vh * 0.6);
width: auto;
}
#imagePlayerDiv div{
border: 1px solid black;
overflow: hidden;
width: 100%;
position:fixed;
}
#contentPlayer{
}
@keyframes scaleImgEffect {
20% {
transform: scale(2.5);
}
40% {
transform: scale(1.5) translate(10%, -5%);
}
60% {
transform: scale(2) translate(15%, 10%);
}
80% {
transform: scale(1.5);
}
100% {
transform: scale(2.5)translate(-20%, -10%);
}
}
<div id="main">
<div id="imagePlayerDiv" style="opacity: 1;">
<div>
<img id="imagePlayer" src="https://c1.staticflickr.com/1/628/22240194016_50afaeb84d_k.jpg">
</div>
</div>
<div id="contentPlayer">
<div id="textPlayer">
<p>"On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains."</p>
</div>
</div>
</div>