Skip to content

Commit

Permalink
! allow bbc images to expand in place properly when they are
Browse files Browse the repository at this point in the history
larger than the layout would allow

Signed-off-by: Spuds <spuds@spudsdesign.com>
  • Loading branch information
Spuds committed Jun 21, 2014
1 parent 1beca50 commit d00e2d4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion themes/default/scripts/theme.js
Expand Up @@ -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);

Expand All @@ -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('<div style="overflow: auto"></div>');
}
else
{
Expand All @@ -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%'});

}
});
});
Expand Down

0 comments on commit d00e2d4

Please sign in to comment.