Step-by-step guide for implementing LoadGo animation with HTML

I'm in the process of loading my logo on my website's homepage. I found a LoadGo animation that I want to use, which can be downloaded Here

Currently, the logo is set to load when a button is clicked. However, I would like it to load automatically when the page loads. How can I properly integrate this into my website so that it displays during the loading process?

Are there any examples or samples available?

This is the code that I have:

<div class="container" style="margin-top: 150px;">
    <div class="col-md-4 col-md-offset-4">
        <img id="cocacola" src="cocacola.png" alt="Coca Cola Logo" class="img-responsive logo"
            style="margin: 0 auto;" />
    </div>
    <div id="demo-progress-1" style="margin-bottom: 10px; font-size: 16px; opacity: 0;
        font-weight: bold;">
        0 %</div>
    <button class="btn btn-primary" onclick="mainDemo();">
        <span class="glyphicon glyphicon-thumbs-up"></span>&nbsp;Start
    </button>
</div>
    <script type="text/javascript">
    var cocacolaInterval;
    function mainDemo () {
      $('#demo-msg-1').animate({
        'opacity': '0'
      });
      $('#demo-progress-1').animate({
        'opacity': '1'
      });

      // rest of the script...
      
    };
    $(window).load(function () {
        $("#cocacola").load(function () {
            // Main demo
            $('#cocacola').loadgo();
        }).each(function () {
            if (this.complete) $(this).load();
        });

        //mainDemo();
       // $(".container").hide();
    });
    </script>

The logo will be hidden after the page finishes loading.

Answer №1

Logo is loading

Check out the code below.

 <script type="text/javascript">
            jQuery(window).on('load', function() {
                jQuery("#logo_loading").fadeOut("slow");
            });
        </script>
        <div id="logo_loading" style="position: fixed; left: 0px; top: 0px; width: 100%; height: 100%; z-index: 999999; background: #27599A url('pepsi.png') center no-repeat; background-size: 80px;"></div>

Answer №2

Moved mainDemo(); to the third line from the end.

var cocacolaInterval;
    function mainDemo () {
      $('#demo-msg-1').animate({
        'opacity': '0'
      });
      $('#demo-progress-1').animate({
        'opacity': '1'
      });
      var p = 0;
      $('#cocacola').loadgo('resetprogress');
      $('#demo-progress-1').html('0%');
      window.setTimeout(function () {
        cocacolaInterval = window.setInterval(function (){
          if ($('#cocacola').loadgo('getprogress') == 100) {
            window.clearInterval(cocacolaInterval);
            $('#demo-msg-1').animate({
              'opacity': '1'
            });
            $('#demo-progress-1').animate({
              'opacity': '0'
            });
          }
          else {
            var prog = p*10;
            $('#cocacola').loadgo('setprogress', prog);
            $('#demo-progress-1').html(prog + '%');
            p++;
          }
        }, 150);
      }, 300);
    };
    
    $(window).load(function () {
        $("#cocacola").load(function () {
            // Main demo
            $('#cocacola').loadgo();
        }).each(function () {
            if (this.complete) $(this).load();
            mainDemo();
        });
    });
    
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link href="http://www.jqueryscript.net/css/jquerysctipttop.css" rel="stylesheet" type="text/css">
<script src="http://www.jqueryscript.net/demo/Image-Loading-Animation-Plugin-with-jQuery-CSS3-LoadGo/loadgo.js"></script>

<div class="container" style="margin-top: 150px;">
    <div class="col-md-4 col-md-offset-4">
        <img id="cocacola" src="http://www.jqueryscript.net/demo/Image-Loading-Animation-Plugin-with-jQuery-CSS3-LoadGo/cocacola.png" alt="Coca Cola Logo" class="img-responsive logo"
            style="margin: 0 auto;" />
    </div>
    <div id="demo-progress-1" style="margin-bottom: 10px; font-size: 16px; opacity: 0;
        font-weight: bold;">
        0 %</div>
    <button class="btn btn-primary" onclick="mainDemo();">
        <span class="glyphicon glyphicon-thumbs-up"></span>&nbsp;Start
    </button>
</div>

Answer №3

Hello there! I am the mind behind the creation of the LoadGo plugin and it's a pleasure to make your acquaintance. As per the guidelines:

This particular plugin does not handle asynchronous behavior related to your loading process, so you will need to take care of that within your application.

LoadGo serves as a front-end plugin, indicating that it does not oversee any loading processes for you; this responsibility falls upon your shoulders.

Explore some additional information below:

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

Elessar - addressing touch event issues

I have been experimenting with implementing multiple ranges using a library called elessar. Despite being a great library, the documentation is lacking. I managed to set everything up but it doesn't seem to work on touch devices. There are no errors s ...

Transitioning to mui5's sx prop instead of makeStyles is generating a typescript error - none of the overloads match this call when passing an object with

I encountered an issue while converting a component to mui 5. Here is the original code snippet: const useStyles = makeStyles({ imageContainer: { display: "flex", width: "65%", float: "left", marginRight ...

Vue component always renders a new line

Whenever I include a <component> tag in my main application, it always renders on a new line. Is there a way to make it inline? I am trying to achieve something like this: <p>This is a component :<component></component></p> & ...

Utilizing jQuery to handle string manipulation via AJAX POST requests

I have been working on developing a checkbox-based filter operation for a website. This feature includes multiple checkboxes that filter a list of records based on different parameters, similar to the implementation found here. So far, I have made progress ...

If you scroll quickly, watch out for the flickering of the fadeIn and fadeOut

I have a script that fades in an element once the user scrolls more than 145px from the top of the page. $(window).scroll(function(){ if ($(this).scrollTop() > 145) { $('#fademenu').fadeIn(); } else { $('#fademenu').fadeOut(); } } ...

Current recommended method for updating innerHTML with properly formatted text?

My understanding is that using innerHTML on an element can be risky, as malicious users could potentially inject harmful content such as <script> tags. This question shows there are multiple alternative tags, some of which are non-standard. In my s ...

Configuring a background logo in WordPress using the Redux framework

I am attempting to integrate a "Logo upload" theme option using Redux framework, but I encountered an issue due to the logo being set up through a stylesheet in my HTML template. How can I configure this logo using an uploader? As a newcomer to WordPress a ...

I am trying to use ajax to upload a photo in ASP.NET MVC, but when the file reaches the controller, it is showing

I am trying to upload a profile photo using Ajax in ASP.NET MVC, but I am encountering an issue where the upload parameter is coming as null to the action method. Here are the HTML codes for the file upload section: <div class="preview"> <di ...

"Utilize jQuery AJAX Promises to Trigger Custom Exceptions that can be Handled by the Outer fail() Function

Imagine having a function that yields a promise. The promise returned is scrutinized by other functions to determine how to manage the .fail() condition. function refreshTimeline() { var promise = ajaxMethod1() .then (function (data) ...

How can I create a clickable <div> element containing multiple links and trigger only one action?

Within my code, there is a <div> element that has been made clickable. Upon clicking this <div>, the height and text expand using the jQuery function $(div).animate();. While this functionality works as intended, I am encountering a slight issu ...

Show the cell data when the checkbox next to it is selected

I have a specific table setup and I am trying to display the content of the table cell if its corresponding checkbox is checked upon clicking a button. For example: If Row2 is checked, an alert box should display Row2 Below is my code snippet, Java ...

Issue with DropdownListFor validation using jQuery when the onchange event triggers submission

DropdownListFor @Html.DropDownListFor(x => x.selectedDateFilter, new SelectList(Model.bydatefilter, "id", "dt", Model.selectedDateFilter), "--Select Date--", new { onchange = @"this.f ...

Struggling to perfectly align a Wufoo form within an iframe using CSS

I have integrated a web form from Wufoo into my webpage using an iframe. Custom CSS can be used to style the form and I am trying to center it within the iframe. Below is the HTML code of the form displayed in the iframe: <div id="container" class="lt ...

Creating a Functional Dropdown Menu with CSS and HTML

I recently created a test site without a drop-down menu, and here is how it looks: Check out my site here: Now, I want to add a simple drop-down menu for "serwery". Can anyone help me figure out what's wrong with my code? Here's the HTML: < ...

Discovering the XPath for a Tag containing both span and div attributes

Can anyone assist me in finding the XPath for this specific element: <a class="channel_code" href="javascript:void(0)" oldtitle="<span style="text-decoration: underline; margin: 4px">CID:</span><div style="margin: 8px 4px 4px;">channe ...

When hovering, the CSS animation will rotate an additional 45 degrees

Currently, I have an element set to rotate 45 degrees when the website is displayed, and this functionality is working as expected. However, I am now looking to enhance it further by making the element rotate an additional 45 degrees every time it is hover ...

Is it possible to utilize JQuery $.post for file uploads?

Similar Inquiry: How can files be uploaded asynchronously using jQuery? jQuery Ajax File Upload I typically use $.post to send form data to a php page for database insertion. However, I am wondering if this same method can be used to upload files, ...

Are conditional comments truly the best approach? What is their functionality and operation like?

A previous question addressing a div positioning issue in Internet Explorer received multiple suggestions advising the use of conditional commenting Why is this relatively positioned div displaying differently in IE? How does one implement conditional co ...

When utilizing the HTML select element, the <option> tag may only display the initial letter of the chosen option

Here is a snippet of my PHP code: <?php if($_POST['post'] == 'Post') { $cat = $_POST['cat']; $update = "UPDATE table SET category='$cat' WHERE id = '$id' "; $result = mys ...

Tips for changing the content of a td element to an input field and removing the displayed value

I am facing an issue with a dynamic table that displays names and input fields. When a name is displayed in a table row, the user has the option to delete that name. I am able to remove the value from a specific table row, but I am struggling to replace th ...