javascript - need to reload for jquery to do the function -


i have code check every height's thumbnail , make thumbnail have height of tallest thumbnail. work first time. test in resolution 768x163 1440x613 thumbnail seems have little space inside caption. try reload page. , bug got fix. how make function work when minimize window without have reload page

this code on height.js

    (function($) {     "use strict";      // thumbnail height     function equalheight(group) {             var tallest = 0;             group.each(function() {                    var thisheight = $(this).height();                    if(thisheight > tallest) {                           tallest = thisheight;                    }             });         group.each(function() { $(this).height(tallest); });     }       $(document).ready(function() {          equalheight($(".thumbnail"));      }); })(jquery);  

heres jsfiddle https://jsfiddle.net/nr2cc6ll/

just call function inside resize method like:

$(window).resize(function() {     equalheight($(".thumbnail")); }); 

simple demo


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -