"Which is better for maximizing the efficiency of an image grid: CSS or Jquery? What are the key

As a UX Designer looking to enhance my coding skills, I must admit my code may not be perfect. Please bear with me as I navigate through this process.

I am in the process of revamping my portfolio website. The original seamless grid was created using a Masonry-like JQuery plugin, but it's quite slow.

To improve performance, I decided to switch to using Masonry, however, I still have concerns about speed. Therefore, I stumbled upon an all-CSS solution that I hope will load faster. https://css-tricks.com/seamless-responsive-photo-grid/

After seeking advice on another platform, I discovered that the issue might not lie with the sluggish plugin but rather in preloading 3MB of images. Despite resizing and optimizing the images to reduce memory usage significantly, the loading speed remains a problem. What could I be missing? How do larger websites manage to load numerous images smoothly while my code struggles? Are there additional optimization techniques I should consider implementing, such as incorporating a loading screen?

[EDIT:] All images have been compressed and optimized. While the images load fairly quickly, the main issue is the Flash of Unstyled Content (FOUC) during the process where JavaScript reformats the images.

Answer №1

It is common to preload 3MB of images, which is the total weight of your images. This is not a problem and is considered normal behavior.

To optimize your website's performance, you may want to consider using an Image Compression Tool. If you anticipate adding more images to your page, implementing Lazy Load with infinite scroll could be beneficial. I personally recommend using this jQuery plugin for static pages.

Edit:

If your website will not have a large number of images, utilizing lazy load and implementing a fade effect once the image is loaded can improve user experience. Two popular jQuery plugins that can help achieve this are:

  • Lazy Load (commonly used)
  • Unveil (minimalistic and quick)

Answer №2

If you want to optimize your website's images, the best approach is to utilize Photoshop's "Save for the Web" feature. However, in addition to image size, there are various factors that can impact a site's loading speed.

Here are some steps you can take:

  • Reduce the size of your images without compromising quality
  • Select a reliable hosting provider
  • Combine and minimize CSS & JS files
  • Limit the number of requests
  • Enable caching
  • Utilize a Content Delivery Network (CDN)

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

Issue with JSON data not functioning properly in AJAX request

I have been facing an issue with detecting whether a database entry has been successfully input. I am sending the new inserted ID and a JSON variable to an AJAX call, which works fine in all browsers but not in phonegAP. Despite that, the data is being suc ...

Clicking the button to send the form using JavaScript

Currently, I am dealing with a shopping cart plugin that relies on a basic form on the product page to send values such as price and product name. However, I am facing an issue where this plugin uses a standard submit button to transmit the values, and I w ...

Bizarre actions with jQuery append in Internet Explorer 8

Issue with adding elements to a div in IE8: The element is not added until the button is clicked twice, resulting in two new elements being added at once. Here's the code snippet in question: $(options.addButton).click(function(event) { var proto ...

What is the process for running child_process when a user clicks on a view in an application

Just starting out with Node.js and utilizing express along with hogan or moustache templating for my views. I've successfully used the following code in my routing files, index.js as shown below: /* Test Shell Execute. */ router.get('/shell&apo ...

What is the best way to create a seamless change from a black to white invert filter?

I'm currently working on a project where I need to change my icons from black to white. After some research, I found that the best way to do this is by using filter: invert(100%). However, when I try to transition it, the change happens abruptly after ...

Modifying routes within the beforeEach function causes issues when the callback incorrectly passes in erroneous routes to and from

I'm currently in the process of developing a mobile frontend using Vue. My goal is to have route transitions dynamically change to slide either left or right based on the current tab index. To accomplish this, I've set up a transition component ...

Deploying an Azure Blob Trigger in TypeScript does not initiate the trigger

After successfully testing my Azure function locally, I deployed it only to find that it fails to trigger when a file is uploaded to the video-temp container. { "bindings": [ { "name": "myBlob", "type&qu ...

Tips for setting extra field values in the CKEditor image dialog during editing

One of my goals is to ensure that any images added in the ckeditor through the image dialog are responsive. To accomplish this: I have created a new option called 'srcset' in the advanced tab I removed the width and height properties from the ...

There was an error during module build process: ReferenceError occurred due to an unrecognized plugin "import" specified in "base" at position 0

I have encountered an error while working on my ReactJS project using create-react-app. The error arose after I added and removed a package called "react-rte". Now, every time I try to start my project, I get the following error: Error in ./src/index.js Mo ...

What is the best way to determine the value of margin-left in inline CSS using jQuery?

Here is the code snippet I am working with: <div class="ongoing" style="width: +728px; margin-left: +12480px"> I need to extract the value of the margin-left property for scrolling purposes. The technique I used to retrieve the width value does no ...

Attempting to utilize ng-click on an element that has been added using element.append() in the postlink phase?

I have been working on customizing a particular angular library to incorporate some new features. https://github.com/southdesign/angular-coverflow/blob/master/coverflow.js As part of this process, I am looking to attach click events to the elements being g ...

Wordpress: The success and error functions in ajaxSubmit options are failing to trigger

jQuery 1.7.2 jQuery Validate 1.1.0 jQuery Form 3.18 Wordpress 3.4.2 In my current coding environment with the jQuery libraries mentioned above, I'm facing an issue with the jQuery Form JS: I've adapted the code for ajaxSubmit from the developer ...

When using jQuery autocomplete and selecting an option by pressing ENTER, it triggers a popup blocker response

In my Office add-in, I have implemented jquery UI autocomplete to provide users with a list of clickable links. When a selection is made from the autocomplete dropdown, it triggers window.open to open the link in a new tab in the default browser. The fun ...

Converting an HTMLElement to a Node in Typescript

Is there a method to transform an HTMLElement into a Node element? As indicated in this response (), an Element is one specific type of node... However, I am unable to locate a process for conversion. I specifically require a Node element in order to inp ...

Executing multiple nested $http calls in Angular can significantly slow down the process

Within my angular application, I am currently dealing with 6 to 7 http chaining requests that are taking a significant amount of time to execute. What are some strategies for optimizing this process? empSvc.getallEmp().then(function (data) { if (dat ...

Using a zoom background image in an HTML document without any accompanying text

I am trying to create a zoom effect on a background image without affecting the text overlaying it. Here is the CSS code: .page1-box { width: 1200px; height:800px; overflow:hidden; } .page1 { width: 100%; height: 100%; background: ...

color of the foreground/background input in a dropdown menu that

I am attempting to modify the foreground or background color utilized by a dash searchable dropdown when text is entered for searching in the list. The input text is currently black, which makes it extremely difficult to read when using a dark theme. Wit ...

I'm having trouble getting Jquery's insertAfter() function to function properly

After creating a parent div and using jQuery's insertAfter() method to insert additional divs, an unexpected issue arises. The first record goes to the bottom, while subsequent records are inserted above it. Below is the function in question: functi ...

Display JSON information in the present moment

I am looking to display only 2 results from a JSON file based on the current time. For example, at 11:00 am today, I want to show only the second and third items. JAVASCRIPT $(data.users).each(function() { var output = "<ul><li>" + this.first ...

Initiate AJAX request when searching (utilizing the pg_search gem)

I've successfully implemented a search form using the pg_search gem, inspired by Railscast #343. Despite my efforts, the page always reloads on search queries. I attempted adding :remote => true to the form and utilized a respond_to block in the con ...