question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

$.fn update not firing

See original GitHub issue

I have a group which has content appended to it via AJAX. At the end of the images loading in the group, I show the content.

If I use: $('.blocks').matchHeight(true); it works perfectly fine.

If I use: $('.blocks').matchHeight(true); outside of the $.ajax call and try utilizing $.fn.matchHeight._update(); to trigger an update when the content is shown, it doesn’t fire.

I have a few other areas where the content is dynamically adjusted and I’d like to have the matchHeight updated but as of now, I can’t do that. I assume sprinkling .matchHeight(true); 's everywhere is probably not the greatest option, so hopefully, I’m just missing something painfully obvious. 😄

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:19 (5 by maintainers)

github_iconTop GitHub Comments

7reactions
liabrucommented, Nov 11, 2015

I think the problem here may be a misunderstanding of how the plugin works.

When you call the _update() function, it will only update the original elements that you have previously applied matchHeight to. Any new elements matching any previously used selectors will not be included because it does not update the set of selected elements.

Instead you need to create a new selection that includes the new element and remove the old one.

Here is an example:

// the original group of .item
$('.item').matchHeight();

// make some ajax call
$.get('/api/something').done(function() { 
    // a new .item is added, but this is not in the original group
    $('body').append('<div class="item">');

    // remove the old group
    $('.item').matchHeight({ remove: true });

    // apply matchHeight on the new selection, which includes the new element
    $('.item').matchHeight();
})

I hope that clears things up.

If this still doesn’t solve the problem you guys are having, please provide more information and an example. Thanks.

0reactions
hippocodescommented, Jun 11, 2018

Hi, I am not having any luck with the following code. I am using a jQuery load more button to load new items (.suitec11-item), but the newly added items are not resizing. The live page is: http://chameleonmethod.com/suite-c11

// MANUALLY CALL MATCHHEIGHT ON SUITEC11 ITEMS jQuery(document).ready(function(){ jQuery('.suitec11-mh').matchHeight(); }); // LOAD MORE POSTS jQuery(document).ready(function(){ jQuery('.load_more a').live('click', function(e){ e.preventDefault(); var link = jQuery(this).attr('href'); jQuery('.load_more').html('<span class="loader">Loading More Posts...</span>'); jQuery.get(link, function(data) { var post = jQuery("#suitec11-sec-two .suitec11-item-wrap", data); jQuery('#suitec11-sec-two .container .row').append(post); }); // remove matchHeight on items, which includes the new element jQuery('.suitec11-mh').matchHeight({ remove: true }); // apply matchHeight on the new selection, which includes the new element jQuery('.suitec11-mh').matchHeight(); jQuery('.load_more').load(link+' .load_more a'); }); });

Any help is much appreciated!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fortnite down? Current problems and outages - Downdetector
Real-time problems for Fortnite. Is the server down? Can't log in? Here you see what is going on.
Read more >
Fortnite Stuck on Checking for Updates, Why is Fortnite Not ...
Players are reporting that Fortnite is not working and that they're stuck on checking for updates on February 1st, 2022.
Read more >
How to Fix "LIBRARY-IN-NOSIGNATURES" Error on Fortnite ...
Chances are that you're not going to have much lucky playing Fortnite on Android until a fresh update or 'hotfix' is rolled out...
Read more >
Fortnite Status (@FortniteStatus) / Twitter
We'll provide an update when we have more information. ... We're investigating an issue where the Prop Mover is not working correctly when...
Read more >
Fortnite: Update v22.00 Downtime - Server Not Responding ...
Server not responding. Iv reset my internet and it's working fine but still cannot get onto Fortnite no matter how many times I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found