Aligning heights with jQuery after an event

I am developing a website that analyzes RSS feeds and displays them in a series of divs. After loading all the downloads, I would like to run the jquery function, which basically takes the height of the highest div and sets all divs equal to that height. You can see the site here: http://vitaminjdesign.com/adrian/

I am currently using the jquery equal-height plugin described below:

function equalHeight(group) {
    var tallest = 0;
    group.each(function() {
        var thisHeight = $(this).height();
        if(thisHeight > tallest) {
            tallest = thisHeight;
        }
    });
    group.height(tallest);
}

and you can call him:

$(document).ready(function() {
$(".block").equalHeights(); 
});

( , div rss-), , , , ? - , , ?

+3
1

equalHeight, AJAX . : (a) (b) . equalHeight , .

equalHeight($(".block")); success AJAX.

$.ajax({
    url: 'someurl.rss',
    success: function(){
        // your code to insert the relevant content

        equalHeight($(".block")); // insert this at the end of each call to the RSS files
    }
});

, , ajaxSuccess AJAX

$(document).ajaxSuccess(function(){
    equalHeight($(".block"));
});
+4

Source: https://habr.com/ru/post/1787843/


All Articles