Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Kirk cperryk

View GitHub Profile
View new.yaml
components:
layout:
instances:
article:
head: head
main: main
bottom:
-
_ref: /components/ad/instances/thecut-bottomLeaderboardDesktopArticle
-
@cperryk
cperryk / gist:2d3250acac8a92a57aac
Last active Sep 30, 2015
Resize SVG height to fit contents using jQuery
View gist:2d3250acac8a92a57aac
function sizeSVG($svg){
var max_x = 0;
$svg.find('*').each(function(){
var bounding_rect = $(this)[0].getBoundingClientRect();
var x2 = bounding_rect.top + bounding_rect.height;
if(x2 > max_x){
max_x = x2;
}
});
$svg.css('height', max_x);