The loading time for Bootstrap Modals on the website has become unbearably slow ever since it was launched

My website was working perfectly fine until I launched it with hosting and a domain. Now, the Modal that is supposed to pop up when clicked is taking too long to load on Safari, Firefox, and IOS, which defeats the purpose of the page. This issue seems to be specific to these browsers while Chrome loads it without any problems.

I have tried various troubleshooting methods such as checking my FTP client, deleting and editing code, re-uploading files, but nothing has resolved the issue. Can someone provide insights into what may be causing this problem?

window.onload = function() {
    const span = document.querySelectorAll(".PopUp");
    span.forEach(item => {
        item.addEventListener('click', showHideModal)
    })
};

function showHideModal(e) {
    const projectNode = e.target.parentNode.parentNode;
    if (!projectNode.matches('.Project, .modal-content')) return;
    e.preventDefault();

    if (projectNode.matches('.Project')) {
        document.getElementById(projectNode.dataset.modal).style.display = "block";
    } else {
        projectNode.parentNode.style.display = "";
    }
}

<head>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>

    <link rel="stylesheet" type="text/css" href="stylesheet.css">
    <script src="ModalPopUp.js"></script>
</head>



<body>
    <div class="content">
        <ul style="list-style: none;">
            <li class="Project" data-modal="myModal_1">
                <span id="myBtn_1">
                    Lirma Type
                </span>
                <span id="year">
                    2019
                </span>

                <div class="Describtion">
                    <p>Typedesign</p>

                    <br>

                    <span class="PopUp">Images</id>
                </div>

                <div id="myModal_1" class="modal">
                    <div class="modal-content">
                        <div id="demo" class="carousel slide" data-ride="carousel">

                            <!-- The slideshow -->
                            <div class="carousel-inner">
                                <div class="carousel-item active">    
                                    <img src="Images/Lirma/type.jpg" alt="img" width="100%">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

            </li>
        </ul>
    </div>
</body>

<script src="ModalHide.js"></script>
<script src="pExpand.js"></script>

Answer №1

It appears that the loading time is mainly due to the images, as Chrome seems to load them faster by utilizing cache memory. However, clearing the cache and reloading the page may result in a longer loading time of about 20 seconds.

1.-chrome without cache

2.-chrome with cache

You can try using an image compressor to reduce the size of the images and enhance download speed

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 steps can be taken to stop 'type-hacking'?

Imagine owning a popular social media platform and wanting to integrate an iframe for user signups through third-party sites, similar to Facebook's 'like this' iframes. However, you are concerned about the security risks associated with ifra ...

Find a way to sift through an array of objects to ensure that each object is distinct from the others

Here is an array where objects with the same values for st and ct should be considered identical. For example, the first and third objects have the same values for st and ct, so the third object should be filtered out of the final array. How can I achiev ...

In AngularJS, the value of a $scope variable cannot be accessed outside of the $http success callback

I am currently new to AngularJS and starting to learn it. Recently, I developed a basic app for displaying content from a JSON file. However, when attempting to access the data assigned to scope outside of the $http function, it returns as undefined. var ...

Attempting to access the 'name' field from an input element in an HTML document using AngularJS, and also introducing a static field named 'likes' with a value

Currently, I am in the process of developing an application that retrieves a list of Beers from an API. Each beer in the JSON response contains the fields {name: "beer", id: number, likes: number}. However, I am facing a challenge while attempting to add ...

Dealing with various menu states using Material-UI Menu component: Tips and Tricks

I've encountered an issue with my dynamically generated dropdowns and accordions that appear at the client-side render (based on validated user purchases from the database). The error seems to stem from my menu anchor element not being able to pinpoi ...

What is the process of creating a MaterialUI checkbox named "Badge"?

Badge API at https://material-ui.com/api/badge/ includes a prop called component that accepts either a string for a DOM element or a component. In my code: <Badge color="primary" classes={{ badge: classes.badge }} component="checkbox"> <Avatar ...

What is the best way to retrieve a value from within several functions?

Below is the code I have been working on: (function() { var origOpen = XMLHttpRequest.prototype.open; XMLHttpRequest.prototype.open = function() { this.addEventListener('load', function() console.log(this.responseTex ...

Extract each line of text from the ul li tags at every level of the hierarchy with the help of

I am looking to extract a list of strings from the ul and li elements with slash (/) separating each level up to the nth level using JavaScript. I attempted to use both the Jquery.map and each functions, but unfortunately, I was unsuccessful. ...

Are there any drawbacks to utilizing data attributes for modifying content through JavaScript?

On my journey of developing a basic web app, I am faced with the challenge of updating data displayed on the screen based on certain events or conditions. The data is spread across various locations and embedded in completely different markup structures. I ...

The battle between HTML5's async attribute and JS's async property

What sets apart the Html5 async attribute from the JS async property? <script src="http://www.google-analytics.com/ga.js" async> versus (function() { var ga = document.createElement('script'); ga.type = 'text/javascript&apo ...

Leveraging JavaScript to compare two arrays and generate a novel array of objects that excludes any items with matching id values

I have a task at hand where I need to create a new array in JavaScript that does not contain objects matching by their id field, using two arrays of objects. The first array consists of: [{id: 1, name: "Jo"}, {id: 2, name: "Pat"}, {id: 3, name: "Mike"}] ...

The click event is malfunctioning. Could someone demonstrate the correct way to troubleshoot this issue?

I encountered an error message that says: Uncaught ReferenceError: toFahrenheit is not defined at HTMLInputElement.onclick I am currently investigating the root cause of this issue, but more importantly, I am seeking guidance on the steps to follow in or ...

Utilizing REACT to extract values from deeply nested JSON structures

Currently, I am utilizing react to display information from properties stored in a nested JSON. While I can successfully render properties like 'name' and 'id' that are not nested, I encounter an issue when trying to access a nested pro ...

Tips for adjusting the dimensions of material table within a react application

Could someone please provide guidance on adjusting the size of a table made with material table? I am currently working in React and the following code is not yielding the desired outcome. I even attempted to use 'react-virtualized-auto-sizer' wi ...

Implementing mouse event listeners on dynamically created elements in Vue.js

I've been curious if anyone has attempted something similar to the following code snippet (created within a Vue.js method): for (let i = 0; i < this.items.length; i++) { let bar = document.createElement('div'); bar.className = this ...

Is it possible to determine if an AJAX request is still ongoing when a user returns to a webpage using jQuery or JavaScript?

Users on a specific page must click a 'generate' button to create details for a record. When the button is clicked, an ajax request is triggered to generate the record, which may take some time. $("#generate_record_button").on("cl ...

Why does the D3.js tooltip keep showing up again even after hovering over the hidden tooltip?

Is there a way to address this issue using D3.js? The problem arises when a user hovers over a point and the tooltip appears. If they accidentally hover over the area where the tooltip was previously visible, it reappears. Although not a major concern in ...

What is the best way to determine whether to use HTTP or HTTPS based on the current URL?

I have a specific line of code in my program that sets the REST URL: this._restUrl = "http://" + this._info.host + "/app/rest/"; However, I am facing an issue when trying to implement SSL. I need help with converting this into a statement that can work w ...

Eliminate any properties with values that exceed the specified number in size

:) I'm trying to create a function that removes properties with values greater than a specified number. I've searched through multiple resources like this question on how to remove properties from a JavaScript object and this one on removing pro ...

"I aim to ensure that my HTML, CSS, and JavaScript project is designed to be highly responsive

Bootstrap implementation on my project is causing issues with mobile view and the positioning of my divs. Take a look at my code below: table { border-collapse: collapse; margin: auto; position: absolute; width: 60%; height: 60%; ...