_gallery.scss 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. ///
  2. /// Paradigm Shift by HTML5 UP
  3. /// html5up.net | @ajlkn
  4. /// Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
  5. ///
  6. /* Gallery */
  7. @include keyframes('gallery-modal-spinner') {
  8. 0% {
  9. @include vendor('transform', 'rotate(0deg)');
  10. }
  11. 100% {
  12. @include vendor('transform', 'rotate(360deg)');
  13. }
  14. }
  15. .gallery {
  16. $gutter: _size(gallery-gutter);
  17. display: flex;
  18. flex-wrap: wrap;
  19. margin: ($gutter * -1) 0 0 ($gutter * -1);
  20. width: calc(100% + #{$gutter});
  21. a {
  22. border-bottom: 0;
  23. display: block;
  24. margin: $gutter 0 0 $gutter;
  25. outline: 0;
  26. position: relative;
  27. width: calc(50% - #{$gutter});
  28. img {
  29. display: block;
  30. height: 25vw;
  31. min-height: 18rem;
  32. object-fit: cover;
  33. object-position: center;
  34. width: 100%;
  35. }
  36. &.landscape {
  37. width: 100%;
  38. img {
  39. height: 30vw;
  40. }
  41. }
  42. &.portrait {
  43. img {
  44. height: 30vw;
  45. }
  46. }
  47. }
  48. .modal {
  49. @include vendor('display', 'flex');
  50. @include vendor('align-items', 'center');
  51. @include vendor('justify-content', 'center');
  52. @include vendor('pointer-events', 'none');
  53. @include vendor('user-select', 'none');
  54. @include vendor('transition', (
  55. 'opacity #{_duration(gallery-lightbox-fadein)} ease',
  56. 'visibility #{_duration(gallery-lightbox-fadein)}',
  57. 'z-index #{_duration(gallery-lightbox-fadein)}'
  58. ));
  59. -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  60. background-color: transparentize(_palette(bg), 1 - _misc(gallery-lightbox-opacity));
  61. height: 100%;
  62. left: 0;
  63. opacity: 0;
  64. outline: 0;
  65. position: fixed;
  66. top: 0;
  67. visibility: none;
  68. width: 100%;
  69. z-index: 0;
  70. &:before {
  71. @include vendor('animation', 'gallery-modal-spinner 1s infinite linear');
  72. @include vendor('transition', 'opacity #{_duration(gallery-lightbox-fadein) * 0.5} ease');
  73. @include vendor('transition-delay', '#{_duration(gallery-lightbox-fadein)}');
  74. background-image: svg-url('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="96px" height="96px" viewBox="0 0 96 96" zoomAndPan="disable"><style>circle {fill: transparent; stroke: #{_palette(fg-bold)}; stroke-width: 2px; }</style><defs><clipPath id="corner"><polygon points="0,0 48,0 48,48 96,48 96,96 0,96" /></clipPath></defs><g clip-path="url(#corner)"><circle cx="48" cy="48" r="32"/></g></svg>');
  75. background-position: center;
  76. background-repeat: no-repeat;
  77. background-size: 4rem;
  78. content: '';
  79. display: block;
  80. height: 4rem;
  81. left: 50%;
  82. margin: -2rem 0 0 -2rem;
  83. opacity: 0;
  84. position: absolute;
  85. top: 50%;
  86. width: 4rem;
  87. }
  88. &:after {
  89. background-image: svg-url('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="64px" height="64px" viewBox="0 0 64 64" zoomAndPan="disable"><style>line {stroke: #{_palette(fg-bold)};stroke-width: 2px;}</style><line x1="20" y1="20" x2="44" y2="44" /><line x1="20" y1="44" x2="44" y2="20" /></svg>');
  90. background-position: center;
  91. background-repeat: no-repeat;
  92. background-size: 3rem;
  93. content: '';
  94. cursor: pointer;
  95. display: block;
  96. height: 4rem;
  97. position: absolute;
  98. right: 0.5rem;
  99. top: 0.5rem;
  100. width: 4rem;
  101. }
  102. .inner {
  103. @include vendor('transform', 'translateY(0.75rem)');
  104. @include vendor('transition', (
  105. 'opacity #{_duration(gallery-lightbox-fadein) * 0.5} ease',
  106. 'transform #{_duration(gallery-lightbox-fadein) * 0.5} ease'
  107. ));
  108. opacity: 0;
  109. img {
  110. box-shadow: 0 1rem 3rem 0 rgba(0, 0, 0, 0.35);
  111. display: block;
  112. max-height: 90vh;
  113. max-width: 90vw;
  114. }
  115. }
  116. &.visible {
  117. @include vendor('pointer-events', 'auto');
  118. opacity: 1;
  119. visibility: visible;
  120. z-index: _misc(z-index-base) + 1000;
  121. &:before {
  122. opacity: 1;
  123. }
  124. }
  125. &.loaded {
  126. .inner {
  127. @include vendor('transform', 'translateY(0)');
  128. @include vendor('transition', (
  129. 'opacity #{_duration(gallery-lightbox-fadein)} ease',
  130. 'transform #{_duration(gallery-lightbox-fadein)} ease'
  131. ));
  132. opacity: 1;
  133. }
  134. &:before {
  135. @include vendor('transition-delay', '0s');
  136. opacity: 0;
  137. }
  138. }
  139. }
  140. @include breakpoint('<=medium') {
  141. a {
  142. img {
  143. height: 20rem;
  144. }
  145. &.landscape {
  146. img {
  147. height: 25rem;
  148. }
  149. }
  150. &.portrait {
  151. img {
  152. height: 25rem;
  153. }
  154. }
  155. }
  156. .modal {
  157. .inner {
  158. img {
  159. max-width: 100vw;
  160. }
  161. }
  162. }
  163. }
  164. @include breakpoint('<=small') {
  165. $gutter: (_size(gallery-gutter) * 0.5);
  166. margin: ($gutter * -1) 0 0 ($gutter * -1);
  167. width: calc(100% + #{$gutter});
  168. a {
  169. margin: $gutter 0 0 $gutter;
  170. width: calc(50% - #{$gutter});
  171. img {
  172. height: 20rem;
  173. }
  174. &.landscape {
  175. img {
  176. height: 20rem;
  177. }
  178. }
  179. &.portrait {
  180. img {
  181. height: 30rem;
  182. }
  183. }
  184. }
  185. }
  186. @include breakpoint('<=xsmall') {
  187. a {
  188. img {
  189. height: 12rem;
  190. min-height: 0;
  191. }
  192. &.landscape {
  193. img {
  194. height: 12rem;
  195. }
  196. }
  197. &.portrait {
  198. img {
  199. height: 14rem;
  200. }
  201. }
  202. }
  203. }
  204. }