Reducing the height of elements with a time delay

My goal is to create a smooth animation where 2 headers fade in and out, followed by the wrapping element shrinking in height.

Unfortunately, I'm encountering an issue where instead of animating, the element abruptly 'shrinks'. Would it be wise to implement CSS animations in some way?

For reference, here is the Fiddle link: http://jsfiddle.net/danieljoseph/37eAC/2/

JQuery

$('.section-intro h1').delay(1000).fadeIn(1000).delay(2000).fadeOut(1000);
$('.section-intro h2').delay(5000).fadeIn(1000).delay(2000).fadeOut(1000);
$('.section-intro div').delay(9000).fadeIn(1000);
setTimeout(function(){
   $(".section-intro").addClass("animate");
}, 12000);

Answer №1

Utilize jQuery's animate method for this solution:

$('.section-intro').delay(12000).animate({height: "20px"}, 500);

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

What CSS selector should I apply to create a circular profile image for Buddypress users?

In my current WordPress project, I am utilizing the BuddyPress, WooCommerce, and WC Vendors plugins for enhanced functionality. To personalize each vendor's product listings, I decided to display their BuddyPress profile picture alongside their produ ...

Is there a way to adjust the opacity of all Vuetify input fields?

I designed a component that includes the following code: <v-text-field style="opacity: 1 !important" class="foo" base-color="primary" ></v-text-field> However, I discovered that the opacity was not changing ...

Tips for adjusting the font size within the MUI TextField Label

I'm looking to adjust the label fontSize in the material ui TextField component. I've discovered the InputLabelProps property which has been helpful, but as shown in the image below, the label appears too cramped when focused. https://i.sstatic. ...

Choose a different PHP value when the selection changes

I am looking to create a seamless connection between a select element and an input text field without the need to refresh the page. Here is an example of what I am trying to achieve: <select name="name_select" id="my_select"> <option value="1" ...

Invisible style date input value on iPhone mobile devices

My goal is to enhance the appearance of an HTML5 input with a custom icon, using a font pack. Although I mention FontAwesome in this example, in reality, I'm utilizing a different custom font pack. On my mobile device (iPhone X), I can see the calend ...

Steps for Adding a class or Id to an Ext.Msg.alert box

Is there a way to customize the style of a specific Ext alert box without affecting all alert boxes? Can someone please explain how to assign a class or ID to an Ext.Msg.alert box? Ext.Msg.alert('Status', 'Changes saved successfully.' ...

The color box is repeatedly opened multiple times within AJAX generated content

Essentially, I have a set of content that triggers a color box to appear when clicked. echo '<div id=scrollimgforplaces>'; while ($row = mysql_fetch_array($result)) { echo "<a class='ajax' href='image_color_box.php?id=".$ ...

Tips for navigating through JSON data that has been retrieved from an API using

Currently working on a JSON form within a custom Joomla component that utilizes a function to retrieve an array of postcodes and then displays them in the view. However, I am encountering an issue with looping through the postcodes using jQuery.each. Here ...

The search bar will display results in the form of links, directing you to individual profiles

I'm trying to enhance my search bar functionality to display the usernames as clickable links that lead to individual user profiles. Here is the PHP code I currently have for the search bar: <?php $servername = "localhost"; $username = "root"; $p ...

How can I use AngularJS to initiate code to run after the view and controller have successfully synchronized a specific change?

I am currently using AJAX to load date ranges into a pair of SELECTs (managed with AngularJS ng-repeat), which are then transformed into a slider using jQuery UI's selectToUISlider. My concern is that selectToUISlider may behave unexpectedly if the SE ...

Display numerical data at precise locations above an image

Currently, I am working on a project where I am adding multiple marker pins to an image and saving their positions (x and y coordinates) to a database for later use. To see the code I have written so far, you can visit this link: https://jsfiddle.net/at3w ...

Is your iPhone struggling to display animation sprites correctly?

After testing on Android and iPhone, I found that the website works great on Android but lags on iPhone. I suspected that the issue might be related to image preloading, so I tried adding a simple jQuery preloader, but it didn't solve the problem. Th ...

How can I make a div take up the entire height of its parent column using Bootstrap?

I need the div with the red border to match the height of the green div on the right. I'm using Bootstrap 4 for this layout! I've experimented with display: flex and flex-grow, and also tried placing the border on the column (which achieves the ...

How can I dynamically assign a value to the <option data-price> tag using JavaScript?

I'm working with an API that provides real-time ETH price data. I need to dynamically insert this price into the data-price attribute of the following HTML element: <option value="ETH" data-price="**HERE**"> Below is a Webho ...

PHP MySQL - Automatically trigger email notification upon insertion of a new record

Is there a way to trigger an email alert only when a new record is added, not when the user edits input fields in a table? The database I'm working with stores equipment delivery dates. Users schedule deliveries and input the dates into a SQL Server ...

Are background images covering hidden text detrimental to accessibility?

Is there a way to display images of text instead of actual text for my menu? I have implemented spans within each menu link. These spans have specific dimensions, block display properties, the text is indented to be hidden, and the background image is set ...

Responsive background with full width for mobile using Bootstrap version 2.3.2

I am facing an issue with mobile resolutions as the background does not expand to 100% width on smaller screens. Here is how it looks: However, everything works fine on higher resolutions. Upon testing my website using , I found that the 100% width backgr ...

Creating Functions with HTML, CSS, and Javascript

I have been working on a website that is designed to convert numbers for you. Most of the code is complete, but I have encountered an error that I am currently unable to resolve. When I try to run the code, I see content on the page but when I click the ...

Interactions with the mouse while using the window.alert and window.confirm features

Currently, I have developed a custom drag method that utilizes mousedown, mouseup, and mousemove events. This method is defined as move(). $(document).on('mousedown', function() {drag = true }); $(document).on('mouseup', function() {dr ...

Enhance your webpage by incorporating various icons and custom spacing using Font Awesome and CSS content

Utilizing Font Awesome icons can be done with the code snippet below: .icon-car { content: "\f1b9"; } Is there a way to include multiple icons (such as \f1b9 and \f1b8), separated by a non-breaking space? ...