I have next script. It works before img load, thou i use method load.
$(document).ready(function() {
  $('.slide-img img').load(function(){
    var height = $(this).height();
    var width = $(this).width();
    if (width > height) {
      $(this).attr('style', 'max-height: 100%');
    };
    if (height > width) {
      $(this).attr('style', 'max-width: 100%');
    };
  });
 });
how can i force script work after loading img?
 
    