Fade reveal text from bottom of line break. CSS / JS
Asked Answered
P

3

-1

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.

Pelf answered 11/9, 2017 at 11:16 Comment(2)
It’s probably not the worst question title of all time ... but you’re quite close. Please go read How to Ask in that regard.Cardioid
@CBroe, edited the question title. I am trying to achieve the best possible fade reveal of all time though.Pelf
U
0

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>
Unhelm answered 11/9, 2017 at 11:31 Comment(0)
G
0

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.

Grappling answered 11/9, 2017 at 12:36 Comment(0)
S
0

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

Scruggs answered 11/9, 2017 at 12:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.