Text fades into view from the bottom after a line break using CSS and JavaScript

I'm looking to create a unique fade reveal text effect for a multi-line H1. The goal is for each line of the text to fade up from its own row, rather than simply revealing from the bottom.

Here's an example I've already developed, but it currently fades everything from the bottom instead of each individual line fading up.

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>

You can see a similar effect in action on this website:

Any suggestions or ideas are greatly appreciated. Thank you!

Answer №1

Here is a code snippet that might serve your purpose:

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>

Answer №2

Here is a solution that may be helpful for you 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 desired effect, I utilized the function jQuery slideDown.

I hope this solution proves to be beneficial for your needs.

Answer №3

If you're looking to add some animation effects to your website, consider using Animate.css. This library is user-friendly and offers a variety of animations for you to choose from. Take a look at the live demo here.

All you have to do is add the class name "animated" along with your desired animation choice. Options such as "slideInDown" or "slideInUp" are available - feel free to experiment with different animations using the provided link.

For those interested, I've included a Working Fiddle demonstrating how to incorporate Animate.css into your project.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is the MDL drawer not reaching the full height of the page?

I am currently utilizing Material Design Lite to incorporate a fixed header and drawer into my Ruby on Rails application. In the following video, you can observe that when I switch to another page, the drawer menu on the left side of the page fails to fill ...

What is the appropriate way to add left padding or left margin to the modal footer in Bootstrap 5.3

I have been working on creating a modal that resembles a chat box. I have completed most of the work, but I am facing an issue with the input area not being fixed. My goal is to have the input text displayed on the footer of the modal, but it seems like th ...

How to align scrolling images with their scroll origin - a step by step guide

Curious to know the name of the effect where images scroll in a different orientation than the page, creating a 2D appearance. Take a look at the Google Nexus website and scroll down - do you see the effect? What is this effect called? Is it created usin ...

Angular Material Dropdown with Multi-Column Support

I'm working on customizing the selection panel layout to display items in multiple columns. However, I'm facing an issue where the last item in each column appears off-center and split, causing overflow into the next column instead of a vertical ...

How to retrieve plain text data from a jQuery ajax call to a PHP server

Having trouble getting my ajax request to a php page to return plain text. Here's the code snippet: $.ajax({ type: 'GET', url: '/shipping/test.php', cache: false, dataType: 'text', ...

What is the best method for embedding Microdata or JSON-LD for an ebook in SVG image format within an HTML5 document?

Recently, I came across Schema.org and am interested in implementing it on my webpages. However, due to time constraints, I haven't been able to delve deep into understanding it fully yet. The issue at hand involves converting a 670-page PDF book wit ...

How do I view a wildcard in my ID selector using jQuery?

When I want to initially hide various content scattered around the page, I usually use the following jQuery code: $('#objective_details, #time_estimate_details, #team_members_details, #resources_details').hide(); Is there a method to utilize a ...

How to handle non-ASCII characters when encoding in JSON?

I understand that json_encode requires UTF-8 encoding, and I have already ensured that my data is encoded as such. However, when attempting to pass a PHP array to JavaScript, I am encountering difficulties in transferring the data successfully. To test th ...

Having trouble copying an iframe from one div to another div?

I'm having trouble transferring an iframe to another div. Here is the code I am using: <script type="text/javascript"> $(document).ready(function () { setInterval(function () { if ($('#d1').html() != $('#d ...

challenge with incorporating rating system using jQuery

I am facing a simple issue here, but my knowledge of jQuery is limited and I'm struggling to find a solution. I have been trying to implement a rating function using the code from this link: Everything seems to be working fine, but I noticed that on ...

Tips for styling the json response received from a servlet with jquery ajax

I am attempting to display a list of users returned from a servlet using jQuery ajax. The first script block is functioning well, successfully presenting the list of users in a formatted manner but experiencing issues passing form parameters such as text a ...

A Step-by-Step Guide to Downloading Images by Clicking

Having an issue with my image download code. When I try to download an image, the process starts but doesn't complete and no file is received. Instead, a type error is encountered. <html> <head> <script type="text/javascript"> funct ...

Extracting information from a database (HTML, JavaScript)

I am currently working on a table that receives data from the server using ajax: $.each(data, function(i, item) { $('#MyTable tbody').append("<tr>" +"<td>" +data[i].A+ "</td><td>" +d ...

Do not need to refresh the form

I developed a PHP-based Feedback form that includes a Popup from Foundation 5. <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <style type="text/css"> .auto-style1 { margin-left: 1px; ...

In Angular/Typescript, dynamically add a class to a `td` element when it is clicked. Toggle the class on and off

My problem arises when trying to individually control the arrow icons for each column in my COVID-19 data table. By using Angular methods, I aim to show ascending and descending arrows upon sorting but run into the challenge of changing arrows across all c ...

Encountering difficulties with the mobile display of a Wordpress theme

I am currently working with the megashop theme on WordPress and I have a few queries that need addressing: Is there a way to modify a specific setting exclusively for views smaller than desktop size, without impacting the desktop view? For example, the m ...

Adding miscellaneous PHP scripts

When a user clicks on the sample button, my PHP code gets appended. It works fine, but I want to clean up my process. After some research, I learned that using jQuery AJAX is the way to go. The only problem is, I'm not sure how to implement AJAX. I&ap ...

Creating an animated CSS growth effect using inline SVG

I'm trying to make these circuits look like they are running downwards. I have the right movement, but I can't seem to start them at their actual size, causing them to appear skewed at the beginning of the animation and then scaling to full size ...

Triggering a click event on a div element to simulate the action of clicking on an anchor link does not yield

I have set the 2nd Id of a div to be a class of an <a> tag. By clicking this div, it will mimic clicking the corresponding <a> tag. $(".component-data").click(function(){ var partNo = $(this).attr('id').split(' ')[1]; ...

Using Plupload plugin to handle file uploads triggers unexpected page refresh when making Ajax requests

I have implemented the Plupload plugin to facilitate the uploading of multiple files. I have linked the FileUploaded event to the uploader in order to execute additional actions once a file has been uploaded. Below is where I am attaching the event. uploa ...