What caused the auto resize feature of the Automatic Image Montage jQuery plugin to malfunction?

Apologies in advance if my issue is a bit convoluted. I've integrated the Automatic Image Montage jQuery plugin into a page I'm currently working on. However, I seem to have disrupted the functionality that automatically resizes images when the window is resized. Everything else with the plugin is functioning correctly. Can anyone spot what I might be doing incorrectly?

I'm not well-versed in jQuery and JavaScript, but I've only made a few adjustments to the max/min image size options in the plugin's js file. The segment within the js file that appears to be linked to this issue is 'smartresize.' If you prefer not to download the demo from the provided link, I've included a de-minified version of the js file below. First, here are the relevant CSS and HTML:

CSS

/*=========================automontage==============================*/
.am-container {
margin-top:75px;
}
.am-wrapper{
float:left;
position:relative;
overflow:hidden;
}
.am-wrapper img{
position:absolute;
outline:none;
}
/*=========================automontage==============================*/

HTML

<div class="am-container" id="am-container">
   <a href="#="asdf"><img src="img/265_s.jpg"></img></a>
   <a href="#" title="asdf"><img src="img/mont1_cloud_s.jpg"></img></a>
   <a href="#" title="asdf"><img src="img/san_diego_street.jpg"></img></a>
   <a href="#" title="asdf"><img src="img/IMG_8576_s.jpg"></img></a>
   <a href="#" title="asdf"><img src="img/IMG_9827_1_s.jpg"></img></a>
   <a href="#" title="asdf"><img src="img/IMG_0999_s.jpg"></img></a>
   <a href="#" title="asdf"><img src="img/Lake_pano_11.jpg"></img></a>
   <a href="#" title="asdf"><img src="img/IMG_8967_s.jpg"></img></a>
   <a href="#" title="asdf"><img src="img/IMG_1346_s.jpg"></img></a>
   <a href="#" title="asdf"><img src="img/IMG_2450.jpg"></img></a>
</div>

In HTML script

<script type="text/javascript" src="js/jquery.montage.min.js"></script> 
<script type="text/javascript">
                /*automontage*/                 
                    $(function() {

                        var $container  = $('#am-container'),
                            $imgs       = $container.find('img').hide(),
                            totalImgs   = $imgs.length,
                            cnt         = 0;

                        $imgs.each(function(i) {
                            var $img    = $(this);
                            $('<img/>').load(function() {
                                ++cnt;
                                if( cnt === totalImgs ) {
                                    $imgs.show();
                                    $container.montage({
                                        fillLastRow             : true,
                                        alternateHeight         : true,
                                        alternateHeightRange    : {
                                            min : 150,
                                            max : 350
                                        }
                                    });


                                    }
                            }).attr('src',$img.attr('src'));
                        }); 

                    });                 

            </script>               

jQuery Plugin File Code (de-minified)

/**
 * jQuery Montage plugin
 * http://www.codrops.com/
 *
 * Copyright 2011, Pedro Botelho
 * Licensed under the MIT license.
 * http://www.opensource.org/licenses/mit-license.php
 *
 * Date: Tue Aug 30 2011
 */
(function( window, $, undefined ) {

/*
* Array.max, Array.min 
* @John Resig
* http://ejohn.org/blog/fast-javascript-maxmin/
*/

// function to get the Max value in array
    Array.max = function( array ){
        return Math.max.apply( Math, array );
    };

    // function to get the Min value in array
    Array.min = function( array ){
       return Math.min.apply( Math, array );
    };

// Rest of the code has been omitted for brevity

Answer №1

Resolved the issue. It appears that updating my jQuery plugin from version 1.6.2 to 1.12.4 caused the plugin to break. After experimenting with different versions, I discovered that version 1.7.0 not only fixed the initial problem but also worked seamlessly with other plugins like magnific popup lightbox and automatic montage. Now everything is functioning perfectly!

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

ng-click-outside event triggers when clicking outside, including within child elements

I am looking to trigger a specific action when I click outside of the container. To achieve this, I have utilized the ng-click-outside directive which works well in most cases. However, there is one scenario where an issue arises. Inside the container, the ...

What is the best way to search the NPM REST API in order to find the most accurate results?

I'm trying to find an effective way to query the npm REST API in order to get relevant search results. I aim to seamlessly integrate this search feature into my application. For instance, when I search for "bootstrap" on npm, I receive various result ...

Tips for effectively utilizing the page-break property within CSS

I am faced with an issue on my HTML page where multiple angular material cards are being displayed: ... <mat-card class="mat-card-98"> <mat-card-header> <mat-card-title>THIS IS MY TITLE</mat-card-title> < ...

Deleting an item from a serialized array using jQuery

I am currently exploring methods to remove an item from a serializedArray based on its index. Take the following scenario: [ { 'name' : 'item1', 'value' : '1' }, { 'name' : 'item2', &ap ...

Unable to locate the node module within the Rails stimulus controller

I'm facing an issue with integrating my own npm package into a Rails application that I have developed. It's unclear whether the problem lies in the creation of the node package or within the rails app itself. The package in question is fairly ...

Encountering an Uncaught Error: MyModule type lacks the 'ɵmod' property

I am currently working on developing a custom module to store all my UI components. It is essential that this module is compatible with Angular 10 and above. Here is the package.json file for my library: { "name": "myLibModule", &qu ...

Tips for retaining a chosen selection in a dropdown box using AngularJS

How can I store the selected color value from a dropdown box into the $scope.color variable? Index.html: <label class="item item-select" name="selectName"> <span class="input-label">Choose your favorite color:</span> <select id="colo ...

One XMLHTTPRequest with multiple replies

My requirement is to have a consolidated XMLHttpRequest call that returns three unique items. These items consist of an HTML formatted table and two separate sets of JSON data for Google Charts. The reason behind this design is that the chart data relies o ...

Is there a way to automatically remove a video using JavaScript once it has completed playing?

This is my HTML section: <section id ="information"> <video id ="videoName" width="800" height="400" controls onplay="myAnimationPicture()""> <source src="video/videoName.mp4" ; type="video/mp4"> Your browser does not support the ...

How can I modify the text color of the Navbar-Brand class in Bootstrap NavBar?

I have been experimenting with various options to change the text color of the `navbar` and specifically the `navbar-brand` item. However, my `.navbar-brand {color: purple;}` CSS class doesn't seem to be working. Can someone please assist me in determ ...

Incorporate a click function onto the image within the canvas

After creating a canvas and placing an image on it, I realized that I need to include a click event for that image. Below is the code snippet I have written in attempt to achieve this. <canvas id="myCanvas" width="578" height="1000"></canvas> ...

There is a random section that keeps crashing on the website

I have encountered a bug on my one-page Bootstrap template website. One of the sections is causing issues after multiple page refreshes. Despite checking the console for errors, I am unable to identify the source of the problem. Here is the HTML code for ...

Stop the setTimeout function after redirecting in the controller

I am experiencing an issue with my AJAX call as it keeps triggering my controller repeatedly. AJAX function <script type="text/javascript> var stopTime =0; var scoreCheck = function () { $.ajax({ url: "<?php echo 'http:// ...

Increase the dropdown size without altering the dimensions of the container

I have a dropdown menu enclosed in a div with a vibrant yellow background. Take a look at the code on Plunker here. Upon clicking the dropdown button, the list expands and the container's height increases as well. The background color of the dropdown ...

Tips for inhibiting default behavior in a modal login form

I am currently working on integrating a login form using the Spring Framework MVC, but I am relatively new to ajax development. Below is a snippet of my index.jsp code: <!-- The Modal --> <div id="modal1" class="modal2"> <span onclick= ...

Material React Card Lists

I am facing a simple problem. I want to create a list of cards from left to right. Currently, the card is centered and when I add another card, it appears below the existing ones. I want them to be arranged from left to right. Please check out the code ex ...

Locating the Searchbox on Google Maps with the angular-google-maps library

I am currently working on positioning the Google Maps searchbox variable in a way that allows it to stay fixed under markers as they are listed. I am utilizing the Angular Google Maps library for this purpose, which provides a directive known as <ui-g ...

Transform the text color of a table generated by a v-for loop

I have a Vue.js setup to exhibit a collection of JSON data which consists mainly of numbers. These numbers are displayed in a table format, with one minor issue - if the number happens to be negative, the text color of its cell needs to be red. <table& ...

Ways to show an input box even when there are no results found

I currently have a database with 5 books, but only 3 of them have prices listed. How can I modify my code to display an input box for all books, regardless of whether they have a price in the database? I am new to coding, so I would appreciate it if you co ...

What steps can I take to ensure that this code is validated prior to proceeding to the subsequent page?

I am experiencing an issue with this HTML fieldset form code. When I click the submit button, it redirects to the next page. However, if I remove "next" from the button class, the form validates but does not proceed to the next page. Can you please help me ...