Is it possible for the logo in the div and the height of the div to vanish after 10 seconds?

Is it possible to conceal a div along with its logo?

I currently have a jpeg logo displayed at the top of my website, but I would like it to vanish after 10 seconds and have the text below it shift upward to fill the space.

I've managed to hide the logo, however, I'm struggling to reduce the box size to 0px so that the lower panel can move up to take its place.

Could someone please provide guidance on achieving this?

Answer №1

Implement jQuery's hide function in combination with a setTimeout:

setTimeout(function() {
    $("#topDiv").hide();
}, 10000);

Another option is to completely remove the element from the webpage:

setTimeout(function() {
    $("#topDiv").remove();
}, 10000);

Answer №2

By employing solely CSS and utilizing animation

Please take note that removing 99%{ opacity:1;} will cause the div to gradually disappear

.logo{
background:blue;
height:0px;
width:50px;
opacity:0;
animation: hide 10s;
}
@keyframes hide {
    0% { opacity:1;height:50px; }
    99%{ opacity:1;height:50px;}
    100%{ opacity:0;height:0px;}
}
.content{
background:red;
height:50px;
width:50px;
}
<div class="logo">
</div>
<div class="content">
</div>

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 is the best way to deliver HTML content to an ASP.NET MVC JSON function?

Here is my jQuery code that I have written along with the json function called InsertMatlabJson. However, I am facing an issue where no text is being passed to the .NET json function. function insert() { var url = '<%=Url.Content( ...

CSS clearfix restricted to immediate parent div

Below is the code snippet that illustrates the objective I am attempting to achieve <div> <div style="float:left; width:220px; height:300px; border: 1px solid #aaa"> Left div <br>float:left <br> fixed width 220px </div> ...

Encountering difficulties when attempting to send an AJAX request, receiving an internal server error 500

I've encountered an issue while sending Ajax calls in a loop. The process seems to work fine for the first two iterations, but then throws an internal server error 500 with the description "The JSON request was too large to be serialized". Here is the ...

Finding the exact location of a specific element within a div: tips and tricks

Is there a way to determine the position of an image inside a div when clicked? Here is my HTML code: <div> <p>test</p> <img src='test1.jpg'/> <p>test</p> <p>test</p> <img src=&ap ...

What is the technique for using JavaScript to implement styling on a <td> within an HTML table?

Can someone help me with applying JavaScript to an entire column in an HTML table? Here is the script I am currently using: I want to insert a line break after each comma in the Message column of the table. Can anyone point out what I'm doing wrong? ...

Switch the active function from click to load

I'm looking to automate a function that checks for mobile internet connection. Currently, the function is triggered by clicking something (OnClick Function), but I want it to run automatically when the app launches! How can I achieve this? This is ...

Tips for preventing the use of website URLs as variables in jQuery ajax() calls:

Having some trouble. For example: $(document).ready(function () { $("#btnSend").click(function () { var noti_p = { url: "Pusher_Controller.ashx", data: "&appname=" + $("#selt1").val() + "&title=" + $("#title"). ...

How can event.target.value and event.target.checked be used simultaneously in React.js?

I have a combination of input fields including text and checkboxes. What is the best way to retrieve all the field values together? Currently, I can only get one value at a time as shown in the example below: handleChange = event => { this.setState( ...

Ensuring Bootstrap retains fullscreen tables while adjusting window size

I have set up a webpage containing a table and a footer. Utilizing bootstrap, I ensured that the footer remains visible while the table adjusts its height based on the remaining space on the screen. While this resizing works perfectly when the window size ...

Creating a table in HTML code

Is it possible to add a print feature to a table and create a button to print the table when clicked? <table border="1"> <tr> <th>Header 1</th> <th>Header 2</th> </tr> <tr> <td>row 1, cell 1</td&g ...

Is there a way for me to recreate the appearance of the outline and labeling found in Material-UI's outlined textfield?

Can anyone help me figure out how to hide the border behind the title text in an outlined textfield from Material-UI that I am trying to imitate? In the image below, you can see "Due Date/Time" taken from Material-UI library where the title hides the bord ...

How to ensure jQuery autocomplete list shows all options when focused and hides after an option is selected?

My form includes an autocomplete feature that triggers the search "onfocus" and displays the options list when the user clicks into the search field, even without entering anything. The issue arises from the fact that the autocomplete requires selecting a ...

Error encountered in the identify() method of Microsoft Face API

While utilizing Microsoft Face API with project oxford in JavaScript, I encountered an issue when using the "identify" function resulting in an error message of "Invalid request body." client.face.identify({ faces: arrayFaceId, personGroupId: "groupId ...

Switching back and forth between selected elements

What I am trying to achieve is a row of images where only one image can be selected at a time. Additionally, if the selected image is clicked on again, it should be deselected. How can I manage to toggle the click event in jQuery to meet these requirements ...

Tips for inserting line breaks within a <p> element in a contentEditable division

When I press enter or shift+enter on my contentEditable div, the new line is shown as a textNode within the div. However, I prefer the new line to be inside a p element. Seeking a straightforward solution Utilizing React Js, I store the content of the co ...

Error: UrlDecodeException in Ajax with Struts2 Framework

Extracting the year information from the HTML and using it to fetch data from the database has been successful when selecting the year from a dropdown menu, however, an exception is thrown when the year is entered as text. URL: <s:url var="loaderU ...

What issues are there with JavaScript?

I encountered an issue with my JavaScript code where it is not producing the expected result. var arr = new Array(); var firstobj = { cta: 0, ccc: 0, crc: 0 } for (var ta = 1; ta <= 10; ta++) { arr[ta] = firstobj; } arr[6].cta = 1; conso ...

What causes the discrepancy in CSS behavior between local and remote websites?

My chrome extension enhances facebook chatbox with jquery autocompletion. I am trying to make the suggestion list menu horizontal by modifying the jquery-ui.css. When changing display:block to display:inline, the list becomes horizontal in a local HTML fil ...

Resetting the state of child components in a React parent component upon updates to the parent state

The main component I'm working with is named ToDoLists. It includes an input field where you can enter a new to-do list name. This component takes an array of lists from its state and generates individual List components based on that array. Each Lis ...

Saving Files in Your React Web Application: Tips and Tricks

Currently, I am working on a React web application that requires the temporary storage of Torrent pieces for streaming purposes using a web player. Any recommendations on how to properly store this data temporarily in order to facilitate the streaming pro ...