Get top style from dynamic content

Get top style from dynamic content

I'm trying to get a top style that is being applied to dynamic added content and assign to an image.
I've built a function w/ Timeout to check if it's parent exists and then get the css(top) value.
It's firing now, but I can't assign the top style to the image margins.

  1. function addGalleryDone() {
  2.         var emarck = $('.justified-gallery .pro').first().find('img').css('margin-left');
  3.         if (($('.justified-gallery').length) && (emarck != '0px')) {
  4.           console.log('Galleryload Done');
  5.           $('a').each(function() {
  6.             var jmari = $(this).css('top');
  7.             var jmar = jmari + '!important';
  8.             console.log('JustifiedMargin: ' + jmar);  // 3px !important
  9.             $(this).find('img').css({'margin-top': ' + jmar + ', 'margin-left': ' + jmar + '});
  10.           });
  11.         }
  12.         else {setTimeout(addGalleryDone, 300);}
  13.       }
  14.       addGalleryDone();

HTML when it's done:
  1. <div class ="justified-gallery">
  2.   <span class="pro">
  3.     <a href="...." style="top: 3px.....">
  4.     <img style="margin-left: -171.5px; .....">
  5.   </span>
  6. </div>