The masonry reorganization is behaving strangely

I've recently started using masonry for the first time and you can check it out here:

Although I have managed to set it up, I am facing some issues with its positioning of boxes when dragging items in.

For example, instead of placing a medium-sized object on the top line followed by two small objects together on the next line, and another medium-sized object at the bottom, it seems to keep the order unchanged which defeats the purpose of using masonry.

You can see this behavior in action in this fiddle: http://jsfiddle.net/danwhitmarsh/zgjBy/

To understand better, adjust the bar between the result and javascript section to see the issue more clearly.

Here is an example of the code:

html

<main id="main" class="js-masonry" data-masonry-options='{ "columnWidth": 320, "itemSelector": ".module","isFitWidth": true }'>
    <!-- INTRO MODULE -->
    <div class="module med-width med-height">

    </div>
    <!--EXAMPLE OF SMALL SMALL MODULE-->
    <div class="module sml-width sml-height">

    </div>

    <!--EXAMPLE OF MEDIUM SMALL MODULE -->
    <div class="module med-width sml-height">

    </div>

    <!--EXAMPLE OF SMALL SMALL MODULE-->
    <div class="module sml-width sml-height">

    </div>

</main>

and here is some css

* {
    padding:0px;
    margin:0px;
    font-family: Arial;
}

#main{
    width: 100%;
    overflow: hidden;
    margin: 0 auto;
}

.sml-width {
    width: 320px;
    background-color:#ccc;
}
.med-width {
    width: 640px;
    background-color:#000;
}
.sml-height {
    height: 320px;
    background-color:#ccc;
}
.med-height {
    height: 640px;
    background-color:#000;
}

Can anyone guide me if I'm overlooking a specific setting that may help resolve this issue?

Answer №1

During our conversation, the writer informed me about a different product he offers

I have found that this product works effectively. It seamlessly fills in gaps that were left untouched by traditional masonry techniques.

Gratefully,

Dan

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

Arrange the selection options by price using jQuery

Sorting options by price is my goal, but despite trying various codes, I have not been successful! This is the original structure: <select id="product-list"> <option>product 1- [2$]</option> <option>product 2- [4$]< ...

Showing JSON object in an Angular 2 template展示JSON对象在模

When I execute the following code: stanservice.categoryDetail(this.params.get('id')) .then((data) => { this.category = JSON.stringify(data.res.rows[0]); console.log(JSON.stringify(data.res.rows[0])); }) .catch((error) => { ...

In my experience, the GET request is functioning properly within Postman, but for some reason the POST method continues to send requests repeatedly

ISSUE: I am encountering a problem while making a POST request in Postman. The application keeps sending requests without receiving any response. I have read through various solutions for Postman hanging during a POST request, but none of them seem to sol ...

Using GraphicsMagick in combination with Node.js to upload a fresh image file to AWS S3: A step-by-step guide

I've encountered an issue while trying to upload images to S3 - phone images appear rotated due to EXIF data. To address this problem, I came across a tool called graphicsmagick which claims to remove EXIF data and resize images to 500px wide. However ...

Trigger a click event in jQuery to activate a form through a hyperlink

I'm facing an issue where I want to implement a password-reset form based on a certain flag being triggered. Currently, my code is set up to prompt the user to change their password if the password_changed_flag is not present. Depending on the user&ap ...

Ways to verify if a div is empty following an ajax request

When trying to load a php page into a div, I encountered an issue where the content of the div appeared empty. Despite attempting various methods to check if the div contained any html content after loading, I was unable to find a solution. ...

Setting the button value to a textbox and refreshing the status information (Codeigniter)

How do I pass the value of my "ACTIVE" status attribute to my textbox? I want to update the user's status by clicking the ACTIVE button. The user's status is currently pending. While I can easily pass the userID, I'm facing an issu ...

Enhancing Navbar Design with Tailwind CSS in NextJS and React

I have not worked with React in a while and just started learning Next.Js. I am trying to figure out how to change the background of my Navbar using Tailwind CSS based on a boolean value "current" (true/false) depending on which page the user is on with Ne ...

Completely Erase a Row from JSON

Does anyone know how to completely remove a specific line from a JSON when using a deletion method? I have a button that determines which line should be removed, but even though the correct index is passed in, the row does not get deleted entirely and just ...

Is there a way to perfectly center text both vertically and horizontally to the right side of an image?

I'm working on developing a mobile website using jQuery Mobile and I want to include images in my "collapsible" elements. Here is the code I am using: <div data-role="collapsible" data-collapsed="true"> <h3><img src="image ...

Issue with BrowserRouter, improperly looping through the array using map

Encountering an issue with importing content in my React app project using <BrowserRouter>. Within the app, there are 3 Material-UI Tabs: /lights, /animations, /settings. <Switch> <Route path="/lights" component={LightsMenu} /> ...

Error message: Django encountering a broken pipe due to AJAX POST request

Broken pipes occur due to conflicting requests, preventing the POST request from processing. In this case, two requests are being sent: Ajax Post redirect to /message.html Adding event.preventDefault() may resolve this issue. However, implementing prev ...

How Can You Change the Position of a Threejs Vector3?

I'm attempting to create bones and then manipulate the vertices of each bone, but I am struggling with the correct syntax. Here is an example of what I have tried: var v = new THREE.Vector3(0,0,0); var b = new THREE.Bone(); b.position.x = 5; b.positi ...

Issue with AngularJS ng-model not updating the value of a hidden input

My goal is to transmit form data using hidden input like this: <input type="hidden" required ng-model="formHolder.template[position].itemKey[itr]" ng-value="[[ formItem ]]" /> The value of formItem can be any string. Issues arise when the strings c ...

Leveraging a JavaScript variable within a PHP snippet

Similar Question: Sending a PHP string to a JavaScript variable with escaped newlines Retrieving a JavaScript variable from PHP I am trying to work with a Javascript function that accepts one variable, having some PHP code embedded within it. I am ...

Looking to display or conceal several divs according to the option selected from a dropdown menu?

I've been searching for a solution to my simple dropdown issue, but haven't had any luck in the forums. This is the code for the dropdown: <select id ="category_faq"> <option value="1">item1</option> <option value= ...

The Bootstrap Tooltip seems to be glued in place

Utilizing jQuery, I am dynamically generating a div that includes add and close buttons. Bootstrap tooltips are applied to these buttons for additional functionality. However, a problem arises where the tooltip for the first add button remains visible even ...

Utilizing Vue.js to initiate a server request with vue-resource

Seeking guidance on performing a server call using vue-resource. I'm unsure about how to set the header and send data via Vue.$http.post Vue.$http.post('http://url/', { email: 'foo', password: 'bar' }, { headers: { ...

The right alignment for ul and li styles is recommended for a cleaner appearance

Here is the fiddle provided below: http://jsfiddle.net/Fx9rA/ <div id="wrap"> <ul id="accordion"> <li> <h2 id="first">CMT</h2> <div class="content"> ...

"Functionality of public methods in JavaScript plugin seems to be malfunction

Recently, I made the decision to redevelop a jQuery plugin using vanilla JavaScript. However, I have encountered an issue with getting the public methods to function properly. Despite all other logic working correctly, the public methods are not respondi ...