From d00e2d437adf8a9a38173c958384dde6e4162501 Mon Sep 17 00:00:00 2001 From: Spuds Date: Sat, 21 Jun 2014 19:22:40 -0400 Subject: [PATCH] ! allow bbc images to expand in place properly when they are larger than the layout would allow Signed-off-by: Spuds --- themes/default/scripts/theme.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/themes/default/scripts/theme.js b/themes/default/scripts/theme.js index 41caa9f7dd..d7260d93d9 100644 --- a/themes/default/scripts/theme.js +++ b/themes/default/scripts/theme.js @@ -74,7 +74,7 @@ $(document).ready(function() { $(this).css({'cursor': 'pointer'}); // Note to addon authors, if you want to enable your own click events to bbc images - // you can turn off this namespaced click eveent with $("img").off("click.elk_bbc") + // you can turn off this namespaced click event with $("img").off("click.elk_bbc") $(this).on( "click.elk_bbc", function() { var $this = $(this); @@ -84,6 +84,10 @@ $(document).ready(function() { $this.data("bbc_img", {width: $this.css('width'), height: $this.css('height')}); $this.css({'width': $this.css('width') === 'auto' ? null : 'auto'}); $this.css({'height': $this.css('width') === 'auto' ? null : 'auto'}); + + // Overide default css to allow the image to expand fully, add a div to exand in + $this.css({'max-width': 'none'}); + $this.wrap('
'); } else { @@ -93,6 +97,11 @@ $(document).ready(function() { // Remove the data $this.removeData(); + + // Remove the div we added to allow the image to overflow expand in + $this.unwrap(); + $this.css({'max-width': '100%'}); + } }); });