What steps can be followed to incorporate a loading gif into this popup and subsequently eliminate it?

These simple inquiries are starting to get on my nerves. I can't keep waiting around for my website designer to resolve this issue. It shouldn't be that difficult... I managed to figure out most of it by researching similar questions, but I could really use some assistance with the final step.

I would like to showcase a loading gif right in the middle of the pop-up window.

I'm aiming to utilize a gif that resembles , but with a backdrop that matches the message-pop-up CSS format displayed below (partially transparent black).

The gif should be perfectly centered within the pop-up.

Most importantly, once the slow function is complete, I want to eradicate the loading gif and replace it with a "finished" text notification.

I believe the provided code should suffice, but if there are any gaps, I will update the question with additional details.

CSS:

.message-pop-up{position: fixed;width: 60%; top: 10%; height: 80%; text-align: center; background: rgba(0,0,0,0.7); color: #fff; z-index: 9999; margin: 0 auto; left: 0; right: 0;display: none;}

jQuery:

$('.form1').submit(function(event) {
  $('.message-pop-up').show();
  $('.popup-text').html("Just a moment please...");
  //display loading gif (how?)
    // ...perform time-consuming tasks...
  //remove loading gif (how?)
  $('.popup-text').html("");
  $('.popup-text').append("Finished!");
});

$('.pop-close').click(function(event) {
  $('.message-pop-up').hide();
});

HTML:

<div class="message-pop-up">
    <p class="pop-close">x</p>
    <p class="popup-text"></p>
</div>

Answer №1

When it comes to HTML, creating a message pop-up can be done with the following code:

<div class="message-pop-up">
    <p class="pop-close">x</p>
    <p class="popup-text"></p>
    <div class="popup-loader-img"></div>
</div>

For styling this pop-up, you can utilize the following CSS:

.popup-loader-img{
    position: absolute;
    width: 100%;
    height: 100%;
    background: url(' http://loadinggif.com/images/image-selection/29.gif ');
    background-position: 50% 50%;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
}

Please note that I have not tested this code myself. Best of luck in implementing it.

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

Sneaky spam and ads embedded within Joomla template

Today, while examining the source code of a Joomla site I am developing, I stumbled upon some hidden links that seem to be spam. I have spent an hour searching through various template files but have been unable to locate them. The hidden links in questio ...

Tips for automatically incorporating animation upon page initialization

I'm looking to add an automatic image effect when the page is loaded. I currently have this code in my js file: $(window).ready(function(){ $(pin).click(function(){ $("#pin01").show().animate({left: '650px'}); }) }); Here is the HTML wit ...

What is the best approach to execute the jquery script exclusively on mobile devices?

I want to modify this code so that it only functions on mobile devices and is disabled on computers. How can I achieve this? <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <body> <ul id="pri ...

Typeahead AJAX in Bootstrap 3

I have implemented the Bootstrap 3 Typeahead plugin This is my current code: <input type="text" class="typeahead" autocomplete="off"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <script&g ...

Is a responsive mega menu with rollover effects available for Bootstrap?

Looking to develop a responsive megamenu for bootstrap 3, I recently came across one that caught my eye: I decided to implement it into my own project at However, I encountered a major issue with the menu functionality on desktop devices, as it requires ...

What is the best way to manage numerous asynchronous post requests in AngularJS?

$scope.savekbentry = function (value) { console.log('save clicked'); console.log(value); console.log($scope.kbentry.kbname); $scope.kbentry.mode = value; var kbname = $scope.kbentry.kbname; var kbd ...

Tips for creating a consistently positioned div element, regardless of the screen size

Having trouble positioning two bars with green or blue filling in the bottom right corner? They keep moving around and not staying in place regardless of screen size. Check out how they are off-screen here Below is the CSS-Styling + HTML code: .eleme ...

Modify path and refresh display upon ajax call to node server

Recently, I made the decision to utilize a Node server as a proxy for making API calls to third-party public APIs from my front end. After successfully sending a request to my Node endpoint and then to the third-party API, I received the expected response. ...

What is the best way to combine a navbar with a video background?

Recently, I delved into Bootstrap and attempted to execute a code for a navbar with a video background. This is what my attempt looked like: HTML Code: <html> <head> <title>Medical</title> <meta charset="UTF-8&qu ...

Launching a jquery dialog from a sibling anchor element without relying on selectors based on IDs

Struggling to solve a simple issue using jQuery UI's dialog function. The challenge lies in displaying custom explanations for search results within dialog boxes triggered by help links. Each result may have notations with corresponding help links tha ...

Running JavaScript in Laravel without explicitly calling it

I am facing a strange issue with my code. I have an input type="button" element along with a JavaScript function in the same page. The goal is to update a table column only when the user presses the button. However, the JavaScript function gets executed ev ...

Execute a function when a selection option is chosen consecutively two times

I have a dynamic dropdown menu that uses AJAX to load options. I need the function to be triggered not only when an option is changed, but also when the same option is clicked multiple times in a row. In other words, I want the function to run every time a ...

Exploding and comparing a div string efficiently using jQuery

I have a hidden div located at the bottom of the page that I need to access. The variable $existing_user holds an array within this hidden div. <div id="existing_user"><?php echo json_encode($existing_user); ?></div> My goal is to compa ...

`Ineffectiveness of CSS media query for font-size adjustment in HTML selector`

I recently implemented the 62.5% trick to adjust my font-size for various screen sizes. However, I noticed that on larger screens, the text appears too small. To address this, I tried increasing the font-size to 80% using a min-width media query. Unfortuna ...

table rows are styled with hover effects and alternating colors using CSS

Styles for even and odd table rows are set, but hovering over the table rows is not working. Test it out here: http://jsfiddle.net/w7brN/ CSS style : #table_even tr:hover { background-color:#fffbae!important; } /* hover effect */ #table_even tr:nth-ch ...

What is the best way to retrieve a C# keyword that is stored within a JObject?

I'm currently utilizing the JQuery QueryBuilder plugin on my website, which organizes its data into JSON format. When it comes to processing this JSON data on the server side code, I encounter an issue with one of the keys being named "operator", whic ...

The background image will expand to fill any available space

I'm currently working on rendering divs with a background image CSS property. The images have fixed sizes, and I want to display them in a grid layout. However, the divs with background images stretch when there is extra space available, which is not ...

Having trouble making class changes with ng-class

I am attempting to change the direction of the arrow in my checkbox by utilizing two classes with the assistance of ng-class. Unfortunately, it is not producing the desired outcome. Below is my code: Note: The angularJS CDN has already been incorporated. ...

Selecting radio button does not update corresponding label

I am having an issue with setting a radio button as checked. In the example snippet, it works perfectly fine but on my localhost, it is not working. Even though the input gets checked, the label does not change. Surprisingly, if I set another radio button ...

Challenges with implementing @Html.EditorForModel

Currently, I am developing a web application using asp.net's mvc-5 framework. In this project, I have implemented the following model class: public class Details4 { [HiddenInput(DisplayValue=false)] public string RESOURCENAME { se ...