Loading screen prior to Lightgallery, isotopes with Imageloaded technology

Currently, I am using LightGallery to showcase my portfolio and Isotope to filter the categories. Since my images are high-quality, I am attempting to utilize ImageLoaded for better performance but facing challenges due to my limited knowledge of jQuery. My goal is to have ImageLoaded load the images in the background while displaying a preloader (CSS or GIF), and upon completion of loading, give the image an entrance effect like a zoom-in. You can find my code on Codepen


$(document).ready(function() {
    var $gallery = $('#gallery');
    var $boxes = $('.revGallery-anchor');
    $boxes.hide();

    $gallery.imagesLoaded( function() {
        $boxes.fadeIn();

        $gallery.isotope({
            // options
            sortBy: 'original-order',
            layoutMode: 'fitRows',
            itemSelector: '.revGallery-anchor',
            stagger: 30,
            masonry: {
                columnWidth: 200
            }
        });
    }); 

    $('button').on('click', function() {
        var filterValue = $(this).attr('data-filter');
        $('#gallery').isotope({ filter: filterValue });
        $gallery.data('lightGallery').destroy(true);
        $gallery.lightGallery({
            selector: filterValue.replace('*','')
        });
    });
});

I am currently struggling with this code and it's not yet complete. I seem to be stuck and uncertain about the next steps. Additionally, the code is not animating as expected.

If you have any tips or advice, please help me out. Thank you!

Answer â„–1

I had to re-add the initialization of $.lightGallery() after losing it. I also incorporated a preloader that fades out once isotope finishes running. To enhance the visual experience, I am initially hiding #gallery using opacity: 0; and then smoothly fading it in post isotope loading completion. The task of creating an image "zoom" effect can be quite complex, so I will leave that part for you to explore further. For reference, here is the link to the updated code snippet: http://codepen.io/anon/pen/pRwEXg

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

Obtain CSS Selector for an element using Selenium

In my current project, I am required to extract the CSS Selectors for specific elements by parsing a webpage. My process involves using Selenium to navigate to the page and then utilizing Python's Beautiful Soup to parse the content in search of eleme ...

Currently dealing with a script that utilizes AJAX GET to incorporate JSON data into my table

Greetings and thank you for taking the time to read this! Within my HTML, I have implemented a form element that allows inputting data into 5 different fields. This data is then transmitted to a database using my unique API key. Once stored in the database ...

Enhancing CSS menus with Jquery or JavaScript to include a delay

As someone who is just starting to learn about jquery and JavaScript, I am seeking help in adding some code to a css menu. My goal is to create a delay between options so that users have enough time to select an option without it closing prematurely. After ...

Building an Autocomplete feature with Materialize CSS in Flask and MySQL

My current task involves creating a Search Bar with autocomplete functionality using Materialize CSS. I have successfully implemented this feature using a simple array. Here is the working code snippet: <input type="text" placeholder="search" id="autoc ...

Preserve multiple selected values post form submission using PHP, HTML, and JavaScript

How can I retain the selected values in a form after it is submitted? My current code functions correctly when only one value is selected, but does not maintain all selected values when multiple are chosen simultaneously. Any assistance would be apprecia ...

Please ensure that busboy on#file completes their task before requesting on#finish

Alright, here's the scenario: req.busboy.on('file', function (fieldname, file, filename, encoding, mimetype) { core.upload(filename, file, function(key2) { if (key2 != null) { key = key2; } console.lo ...

Pop-up modal from Bootstrap appearing on top of the page header

I'm working on a website layout where the header always stays on top of everything. However, whenever I add a bootstrap modal that pops up, it ends up covering the header with a grey area. I've attempted to adjust the z-index values for both the ...

Is it possible to animate captions and slides individually within a Bootstrap 5 carousel?

Beginner coder here, testing my skills with a self-assigned task. I've created a carousel using Bootstrap 5 with three slides, each containing two lines of captions. As the slides transition, the captions move in opposite directions—up and down. Ho ...

Ways to add Bootstrap Icon to Button

I am trying to create a button using the createElement method in JavaScript. I want to include a bootstrap delete icon within this button. This is my current code: const deleteButton = document.createElement('button'); deleteButton.innerHTML = & ...

Issue persists: Ajax functionality remains nonfunctional, prompting the need for

My goal is to use the post input, and upon hitting enter, I want to dynamically replace <div id="mainPagePosts"></div> with new data without causing a page refresh. However, even after submitting the post, the page still refreshes, although I d ...

The use of a Bootstrap row is leading to incorrect dimensions for FullPageJS

Within the body tag, I have included the following code snippet: <div id="container"> <div class="section profile"> <div class="row"> <div class="col-sm-6"> A </div> ...

Unable to target a dynamic div and utilize solely its image

Can someone provide some assistance with a jQuery issue I am facing? I have a lengthy list of images directly uploaded from YouTube, each image has the same "v-code" as its corresponding video. To simplify the downloading process for all videos on one page ...

Having difficulty scrolling down in a section with 100% height on iOS devices

Currently facing an issue with a website I am creating for my wedding invitation. The top section is set to have a 100% height and requires scrolling to view the rest of the content. While it functions perfectly on FireFox / Chrome on my computer, there s ...

When it comes to utilizing jQuery for the mobile view, how many jQuery libraries are recommended for optimal performance?

I'm currently constructing a website using ROR, and for the mobile view, I've implemented the mobile_fu gem. The designer provided me with a design for the mobile view that includes various jQuery sliders, players, image sliders, drop-down menus ...

Obtaining the data attribute or id of a clicked element in Bootstrap 2.3.2 modal and jQuery 1.7.1: A step-by-step guide

Unfortunately, I am restricted to using bootstrap 2.3.2 modal along with jquery 1.7.1. Below is the code snippet for three conference rooms. When an element is clicked, a modal popup appears correctly, but there is a struggle in fetching t ...

Switching the icon after the label is clicked

Currently, I am working on the following code snippet: <GridLayout columns="*, *"> <Label text="Question" textWrap="true" (tap)="onTap(0)" class="h2 que" col="0"></Label> ...

Sending a JavaScript string to a PHP script from a Chrome extension content script

I am currently developing a chrome extension that is designed to extract text data from specific websites when I visit them, and then store this data in a SQL database. The JavaScript code for data extraction is functioning correctly and is able to capture ...

Revise the "Add to Cart" button (form) to make selecting a variant mandatory

At our store, we've noticed that customers often forget to select a size or version before clicking "Add to Cart" on product pages, leading to cart abandonment. We want to add code that prevents the button from working unless a variant has been chosen ...

Verify the presence and delete a table row from the JSON data that is returned

Is there a way to verify the presence of a label in the JSON response and exclude it from the displayed row in my table? In the code snippet below, you can observe that I am returning 'Page Name not defined'. I want to hide this label and any re ...

What is the best way to verify HTML using RSS?

Looking to improve my skills in HTML/CSS/PHP development, I'm faced with a challenge when it comes to validating code that contains content beyond my control, such as an RSS feed. For instance, on my home page, which is a .php document containing bot ...