diff --git a/layout/_third-party/fancybox.ejs b/layout/_third-party/fancybox.ejs index bf0aca4..545a1a7 100644 --- a/layout/_third-party/fancybox.ejs +++ b/layout/_third-party/fancybox.ejs @@ -1,18 +1,43 @@ diff --git a/scripts/tags/fancybox.js b/scripts/tags/fancybox.js index a9460d8..1f10a44 100644 --- a/scripts/tags/fancybox.js +++ b/scripts/tags/fancybox.js @@ -5,11 +5,11 @@ function postFancybox(args, content) { var cls = args[0]; var col = Number(args[1]) || 0; if (col > 0) { - return `
+ return ``; } else { - return `
+ return ``; } diff --git a/scripts/tags/image.js b/scripts/tags/image.js index 2b9a71e..d3ba83a 100644 --- a/scripts/tags/image.js +++ b/scripts/tags/image.js @@ -5,10 +5,13 @@ function postImage(args) { let url = (args[0]||'').trim() let title = '' let width = '' + let cls = '' function getP2(p2) { let px = p2.match(/^[0-9]*px$/g) if (px) { width = px[0] + } else if (p2 == 'inline') { + cls = 'class="inline"' } else { title = p2 } @@ -21,25 +24,15 @@ function postImage(args) { } if (width.length > 0) { if (title.length > 0) { - return `
- - ${title} -
`; + return `${title}`; } else { - return `
- -
`; + return ``; } } else { if (title.length > 0) { - return `
- - ${title} -
`; + return `${title}`; } else { - return `
- -
`; + return ``; } } } diff --git a/source/css/_third-party/fancybox.styl b/source/css/_third-party/fancybox.styl index 06eeabe..e750662 100644 --- a/source/css/_third-party/fancybox.styl +++ b/source/css/_third-party/fancybox.styl @@ -1,42 +1,51 @@ -div.fancybox +div.gallery margin: $gap-row 0 overflow: hidden $sp = 1px - >a,>p>a + >.fancybox,>p>.fancybox margin: $sp padding: 0 - line-height: 0 - overflow: hidden - align-items: stretch - border-radius: 2px - cursor: zoom-in - @media screen and (max-width: $device-mobile) - border-radius: 1px - - br - display: none !important + position: relative + .image-caption + opacity: 0 + transform: translateY(100%) + transition: all 0.3s ease + pointer-events: none + position: absolute + width: 100% + bottom: 0 + text-align: center + background: rgba(0, 0, 0, 0.3) + color: #fff + &:empty + display:none + &:hover + .image-caption + opacity: 1 + transform: translateY(0) &,>p display: flex justify-content: center align-items: center flex-wrap: nowrap padding: 0 !important + align-items: stretch &[col]>p flex-wrap: wrap justify-content: flex-start - &[col='2']>p>a + &[col='2']>p>.fancybox width: "calc(50% - 2 * %s)" % $sp - &[col='3']>p>a + &[col='3']>p>.fancybox width: "calc(33.33% - 2 * %s)" % $sp - &[col='4']>p>a + &[col='4']>p>.fancybox width: "calc(25% - 2 * %s)" % $sp - &[col='5']>p>a + &[col='5']>p>.fancybox width: "calc(20% - 2 * %s)" % $sp - &[col='6']>p>a + &[col='6']>p>.fancybox width: "calc(16.66% - 2 * %s)" % $sp - &[col='7']>p>a + &[col='7']>p>.fancybox width: "calc(14.2857% - 2 * %s)" % $sp - &[col='8']>p>a + &[col='8']>p>.fancybox width: "calc(12.5% - 2 * %s)" % $sp >p margin: 0 @@ -56,13 +65,25 @@ div.fancybox cursor: zoom-out .fancybox - &.caption - flex-direction: column - a - margin: 0 - .gallery - overflow: hidden - .image-caption - font-size: $fontsize-code - margin-top: $gap-row - color: $color-meta + display: flex + flex-direction: column + justify-content: center + align-items: center + flex-wrap: nowrap + padding: 0 !important + overflow: hidden + border-radius: 2px + @media screen and (max-width: $device-mobile) + border-radius: 1px + a + line-height: 0 + margin: 0 + align-items: stretch + cursor: zoom-in + .gallery + overflow: hidden + .image-caption + font-size: $fontsize-code + padding-top: $gap-row + padding-bottom: $gap-row + color: $color-meta