javascript - jquery ready and resize function doesn't work -


hello had problem reason occurs when upload website server problem need group of images same size group of divs , need function load on ready , resize function work when resize document/window rather ready/load, when need both.

$(document).ready(function(){   $(window).on('resize ready', function(){          var heightval = $('#main-contentp1').height();         $("#fom-desc").height(heightval);         var heightvalb = $('#moodboard-box-ca').height();         $("#vmt-pic-sec").height(heightvalb);         var heightvalc = $('#view-blog-seca').height();         $(".vmt-pic-sec").height(heightvalc);      });  }); 

well adding ready event listener inside $(document).ready() runs after document ready. ready won't fired.

try this:

$(document).ready(function(){ myfunction(); $(window).on('resize', myfunction); });  function myfunction(){  var heightval = $('#main-contentp1').height();     $("#fom-desc").height(heightval);     var heightvalb = $('#moodboard-box-ca').height();     $("#vmt-pic-sec").height(heightvalb);     var heightvalc = $('#view-blog-seca').height();     $(".vmt-pic-sec").height(heightvalc); } 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -