Skip to content

Commit

Permalink
add gallery support. Fix max-width of wide iamges
Browse files Browse the repository at this point in the history
  • Loading branch information
zutrinken committed Sep 3, 2018
1 parent c7efb30 commit 6c3b7ff
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 6 deletions.
4 changes: 2 additions & 2 deletions assets/css/style.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/script.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "attila",
"description": "Ghost Theme",
"demo": "http://attila.zutrinken.com",
"version": "1.7.4",
"version": "1.7.5",
"engines": {
"ghost": ">=1.25.0"
"ghost": ">=2.1.0"
},
"license": "MIT",
"screenshots": {
Expand Down
16 changes: 16 additions & 0 deletions src/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,22 @@ jQuery(function($) {
}
});

/* ==========================================================================
Gallery
========================================================================== */

function gallery() {
var images = document.querySelectorAll('.kg-gallery-image img');
images.forEach(function (image) {
var container = image.closest('.kg-gallery-image');
var width = image.attributes.width.value;
var height = image.attributes.height.value;
var ratio = width / height;
container.style.flex = ratio + ' 1 0%';
});
}
gallery();

/* ==========================================================================
Style code blocks with highlight and numbered lines
========================================================================== */
Expand Down
46 changes: 45 additions & 1 deletion src/sass/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ img[src$="#full"] {
max-width: none !important;

&.kg-width-wide {
max-width: 48em;
max-width: 48em !important;
min-width: 100%;
width: 75vw;
}
Expand Down Expand Up @@ -379,6 +379,50 @@ img[src$="#full"] {
}
}

.kg-gallery-card {
margin: 0 0 2em;
max-width: 48em !important;
min-width: 100%;
width: 75vw;

figcaption {
font-family: 'Fira Sans', sans-serif;
color: $color-blue-60;
text-align: center;
max-width: 32em;
margin: auto;
font-size: 0.75em;
line-height: 1.25em;
padding: 0.667em 0;
}
}

.kg-gallery-container {
display: flex;
flex-direction: column;
}

.kg-gallery-row {
display: flex;
flex-direction: row;
justify-content: center;
}

.kg-gallery-image img {
display: block;
margin: 0;
width: 100%;
height: 100%;
}

.kg-gallery-row:not(:first-of-type) {
margin: 0.75em 0 0 0;
}

.kg-gallery-image:not(:first-of-type) {
margin: 0 0 0 0.75em;
}

.kg-embed-card {
margin: 0 0 2em;

Expand Down

0 comments on commit 6c3b7ff

Please sign in to comment.