问题
So, I need to achieve a really nice fade reveal text effect. Imagine a H1 that's spread across two lines. The text would need to reveal up from the base of each line. However I'm unsure of how to do this with multi-lined text (that isn't split into separate heading tags).
Here's one I created already, however this fades everything from the bottom. Ideally I want each line to fade up from its own row.
setTimeout(function(){
$('.ready').addClass('active');
}, 1500);
.overflow-hidden {
overflow:hidden;
}
h1 {
padding:0;
max-width:500px;
margin:0;
font-family:sans-serif;
}
.ready {
opacity:0;
transform: translateY(50px);
}
.active {
opacity:1;
transform: translateY(0px);
}
.reveal-in {
-webkit-transition: all 600ms ease-in-out;
-moz-transition: all 600ms ease-in-out;
-ms-transition: all 600ms ease-in-out;
-o-transition: all 600ms ease-in-out;
transition: all 600ms ease-in-out;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="overflow-hidden iv-wp">
<h1 class="ready reveal-in">
This is text over two lines, with a really nice fade effect.
</h1>
</div>
Similar to this reference -
https://basicagency.com/
Thanks guys.
回答1:
I think you are looking for something like this:
setTimeout(function(){
$('.ready').addClass('active');
}, 1500);
.overflow-hidden {
overflow:hidden;
}
h1 {
padding:0;
max-width:500px;
margin:0;
font-family:sans-serif;
}
.ready {
opacity:0;
transform: translateY(50px);
}
.active {
opacity:1;
transform: translateY(0px);
}
.reveal-in {
-webkit-transition: all 600ms ease-in-out;
-moz-transition: all 600ms ease-in-out;
-ms-transition: all 600ms ease-in-out;
-o-transition: all 600ms ease-in-out;
transition: all 600ms ease-in-out;
}
.reveal-in2 {
-webkit-transition: all 100ms ease-in-out;
-moz-transition: all 100ms ease-in-out;
-ms-transition: all 100ms ease-in-out;
-o-transition: all 100ms ease-in-out;
transition: all 100ms ease-in-out;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="overflow-hidden iv-wp">
<h1 >
<span class="ready reveal-in">This is text over two lines, with</span>
<span class="ready reveal-in2"> a really nice fade effect.</span>
</h1>
</div>
回答2:
Here you go with a solution https://jsfiddle.net/x5fgnbpx/1/
setTimeout(function(){
$('.ready').slideDown("slow");
}, 1500);
.overflow-hidden {
overflow:hidden;
}
h1 {
padding:0;
max-width:500px;
margin:0;
font-family:sans-serif;
}
.ready {
opacity:1;
display:none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="overflow-hidden iv-wp">
<h1 class="ready reveal-in">
This is text over two lines, with a really nice fade effect.
</h1>
</div>
To achieve the same, I've used jQuery slideDown
.
Hope this will help you.
回答3:
You can use Animate.css which is quite easy to use. You can check the demo here.
All you need to do is to add a class name which is animated
and your choice of animation which can be found on the link provided. You can choose slideInDown
or slideInUp
or more. Check and play with the demo link that I have provided.
Added a Working Fiddle
来源:https://stackoverflow.com/questions/46154421/fade-reveal-text-from-bottom-of-line-break-css-js