javascript - jQuery to vertically center text only loads after page resize -


i have following jquery vertically center text next image loads after page re-sized.

$(window).load(function () {     $(function () {         var changeheight = function () {             $('.vertical-align').height($('.featurette-image').height());         }         $(window).on('resize', function () {             if ($(window).width() > 765) {                 changeheight();             } else {                 $('.vertical-align').height('auto');             }         })     }) });    

remove window resize , should work on load

$(window).load(function() {     var changeheight = function() {       $('.vertical-align').height($('.featurette-image').height());     }       if ($(window).width() > 765) {         changeheight();       } else {         $('.vertical-align').height('auto');       }  });


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -