can3p (can3p) wrote in changelog,
can3p
can3p
changelog

[livejournal] r21408: LJSUP-11475: After opening, image have i...

Committer: dpetrov
LJSUP-11475: After opening, image have incorrect size
U   trunk/htdocs/js/journal.js
Modified: trunk/htdocs/js/journal.js
===================================================================
--- trunk/htdocs/js/journal.js	2012-03-14 08:26:37 UTC (rev 21407)
+++ trunk/htdocs/js/journal.js	2012-03-14 08:44:00 UTC (rev 21408)
@@ -309,21 +309,13 @@
 			imgLoaded: function(el, image) {
 				var img = jQuery('<img />').attr('src', image.src),
 					$el = jQuery(el),
-					href = $el.data('href');
+					href = $el.data('href'),
+					imw = $el.data('width'),
+					imh = $el.data('height');
 
-				var style = $el.attr('style'),
-					imw, imh;
+				if (imw) { img.width(imw); }
+				if (imh) { img.height(imh); }
 
-				if (style) {
-					//easy way to parse style string
-					var d = jQuery('<div>').attr('style', style);
-					imw = d.width();
-					imh = d.height();
-
-					if (imw) { img.width(imw); }
-					if (imh) { img.height(imh); }
-				}
-
 				if (href && href.length > 0) {
 					img = jQuery('<a>', { href: href }).append(img);
 					$el.next('.b-mediaplaceholder-external').remove();

Tags: can3p, dpetrov, js, livejournal
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments