Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8152979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:52:12+00:00 2026-06-06T15:52:12+00:00

I am using both JQuery Masonry and Twitter bootstrap together but experiencing a few

  • 0

I am using both JQuery Masonry and Twitter bootstrap together but experiencing a few problems. I do not think that the problem is caused by any conflict between the two.

I am using Bootstrap Thumbnails, to provide image/text divs and then using Masonry to arrange them all more nicely.

I’m keen that in the future new content inserted into each of these thumbnail divs is not constrained too much, as some of it will be dynamically loaded and I want the divs to be able to expand as they need to. I would like to have the flexibility to toggle content visibility or have flyout content on hovers etc which as it happens triggers Masonry to reset its layout positions.

To test how Masonry will respond to this I have changed the CSS of the .thumbnail class so that when hovering the thumbnail div (each has class ‘.thumbnail’) it gains bottom padding (which is forcing it’s height to expand).

When Masonry loads it works great and positions everything based on it’s initial size.

When you hover the thumbnails the css hover kicks in and makes containers expand in height but forces them to overlap the thumbnail below.

To overcome this I have linked to an external .js file and have added some custom jquery, it’s nice and simple and just executes a function on hover over each thumbnail which tells Masonry to refresh/reload. This works well while hovering over the thumbnails, the css hover kicks in, div expands and then Masonry repositions all the divs for best fit to accomodate the new div size.

MY PROBLEM: when you then move the mouse out of the thumbnail Masonry does not recognise the change in the ‘css hover’ back to its original state and so the thumbnail’s height reduces and leaves a gap between itself and the thumbnail below. It’s like Masonry is not recognising the new height values when the Div reduces in height but does recognise when the Div height expands?

I am running the same function in my custom external .js for both states of the jQuery hover and was hoping that Masonry would respond okay, but has not. Any ideas?

I define all the initial Masonry with:

<script type="text/javascript">
$(window).load(function(){
    $('.container-fluid').masonry({
    itemSelector: '.thumbnail',
    isAnimated: true,
    animationOptions: {
        duration: 750,
        easing: 'linear',
        queue: false
        }   
    });    
})              
</script>  

and my custom .js file contains:

$(document).ready(function(){
$('.thumbnail').hover( 
    function(){run()},
    function(){run()}                     
);
});

function run() {$('.container-fluid').masonry('reload');}

Any help would be appreciated.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T15:52:14+00:00Added an answer on June 6, 2026 at 3:52 pm

    As I suspected, it seems to be a time-related, or event ordering issue.

    This is not guaranteed, but I think that the handlerOut trigger is called before the browser resizes the not hover anymore .thumbnail. But this is just wild guessing.

    Anyway, this is what you should use :

    $('.thumbnail').hover( 
        function(){run()},
        function(){setTimeout(function(){run()}, 200)}                     
    );
    

    The timeout allows things to happen in between, the value is a bit random, as long as it doesn’t disturb user-experience.

    Seems to works in this jsfiddle.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web application that is using both jQuery 1.2.6 and YUI 2.6.0
I'm looking for a technique using JQuery to remove an html tag (both opening
i'm loading, using the JQuery ajax() method, an external page with both html and
I tried using both ReadProcessMemory() and WriteProcessMemory() in my application,but in both cases I
I am using both JQuery UI Dialog and JQuery UI autocomplete both have the
I've been at this one for a while now: I'm using both jQuery and
I am using both javascript and jquery code on the same html page. For
I'm using both JSF 2.0 and jQuery/javaScript, where needed. I'm trying to add and
I'm using both Primefaces 2.2.1 and jQuery (latest version 1.7) in my application, and
I have a simple jQuery animation using fadein and it works but once faded

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.