From 382401d527314b270e1c67b4f88cd3bfbca81d46 Mon Sep 17 00:00:00 2001 From: Victor Häggqvist Date: Thu, 14 Jan 2016 22:54:43 +0100 Subject: create plugin architecture --- style/_variables.scss | 2 - style/plugins/activity-indicator.scss | 50 ++++++++++++ style/plugins/closebutton.scss | 54 ++++++++++++ style/plugins/overlay.scss | 17 ++++ style/touch-imagelightbox.scss | 149 ++-------------------------------- 5 files changed, 129 insertions(+), 143 deletions(-) delete mode 100644 style/_variables.scss create mode 100644 style/plugins/activity-indicator.scss create mode 100644 style/plugins/closebutton.scss create mode 100644 style/plugins/overlay.scss (limited to 'style') diff --git a/style/_variables.scss b/style/_variables.scss deleted file mode 100644 index d2deae5..0000000 --- a/style/_variables.scss +++ /dev/null @@ -1,2 +0,0 @@ -$closebutton-size: 40px; -$loadingbox-size: 20px; diff --git a/style/plugins/activity-indicator.scss b/style/plugins/activity-indicator.scss new file mode 100644 index 0000000..d5df8c0 --- /dev/null +++ b/style/plugins/activity-indicator.scss @@ -0,0 +1,50 @@ +$loadingbox-size: 20px; + +#imagelightbox-loading, +#imagelightbox-loading div { + border-radius: 50%; +} + +#imagelightbox-loading { + box-shadow: rgba(0, 0, 0, .75) 0 0 $loadingbox-size*2; + + background: #444; // Fallback + background: rgba(0, 0, 0, .5); + height: $loadingbox-size; + left: 50%; + margin: -20px 0 0 -20px; + padding: 10px; + position: fixed; + top: 50%; + width: $loadingbox-size; + z-index: 10003; + animation: fade-in .25s linear; + + div { + animation: imagelightbox-loading .5s ease infinite; + + background-color: #fff; + height: 20px; + width: 20px; + } +} + +@keyframes imagelightbox-loading { + 0% { + opacity: .5; + transform: scale(.75); + } + 50% { + opacity: 1; + transform: scale(1); + } + 100% { + opacity: .5; + transform: scale(.75); + } +} + +@keyframes fade-in { + 0% { opacity: 0; } + 100% { opacity: 1; } +} diff --git a/style/plugins/closebutton.scss b/style/plugins/closebutton.scss new file mode 100644 index 0000000..68b813b --- /dev/null +++ b/style/plugins/closebutton.scss @@ -0,0 +1,54 @@ +$closebutton-size: 40px; + +#imagelightbox-close { + border-radius: 50%; + + background-color: #666; + height: $closebutton-size; + position: fixed; + right: $closebutton-size; + text-align: left; + text-indent: -9999px; + top: $closebutton-size; + transition: color .3s ease; + width: $closebutton-size; + z-index: 10002; + + &:hover { + background-color: #111; + } + + &:before, + &:after { + background-color: #fff; + bottom: 20%; + content: ''; + left: 50%; + margin-left: -1px; + position: absolute; + top: 20%; + width: 2px; + } + + &:before { + rotate: 45deg; + } + + &:after { + rotate: -45deg; + } + + animation: fade-in .25s linear; +} + +@keyframes fade-in { + 0% { opacity: 0; } + 100% { opacity: 1; } +} + +@media only screen and (max-width: 660px) { + #imagelightbox-close { + right: 20px; + top: 20px; + } +} diff --git a/style/plugins/overlay.scss b/style/plugins/overlay.scss new file mode 100644 index 0000000..edbc05a --- /dev/null +++ b/style/plugins/overlay.scss @@ -0,0 +1,17 @@ + +#imagelightbox-overlay { + background: #fff; + background: rgba(255, 255, 255, .9); + bottom: 0; + left: 0; + position: fixed; + right: 0; + top: 0; + z-index: 9998; + animation: fade-in .25s linear; +} + +@keyframes fade-in { + 0% { opacity: 0; } + 100% { opacity: 1; } +} diff --git a/style/touch-imagelightbox.scss b/style/touch-imagelightbox.scss index c9df56f..ec6f006 100644 --- a/style/touch-imagelightbox.scss +++ b/style/touch-imagelightbox.scss @@ -1,5 +1,7 @@ -@import 'compass/css3'; -@import 'variables'; + +@import "plugins/activity-indicator"; +@import "plugins/overlay"; +@import "plugins/closebutton"; @mixin touch-action($value) { -ms-touch-action: $value; @@ -13,125 +15,12 @@ html { #imagelightbox { @include touch-action(none); - @include box-shadow(rgba(0, 0, 0, .75) 0 0 50px); + box-shadow: rgba(0, 0, 0, .75) 0 0 50px; cursor: pointer; position: fixed; z-index: 10000; } -// Loading Indication -#imagelightbox-loading, -#imagelightbox-loading div { - @include border-radius(50%); -} - -#imagelightbox-loading { - @include box-shadow(rgba(0, 0, 0, .75) 0 0 $loadingbox-size*2); - - background: #444; // Fallback - background: rgba(0, 0, 0, .5); - height: $loadingbox-size; - left: 50%; - margin: -20px 0 0 -20px; - padding: 10px; - position: fixed; - top: 50%; - width: $loadingbox-size; - z-index: 10003; - - div { - -moz-animation: imagelightbox-loading .5s ease infinite; - -o-animation: imagelightbox-loading .5s ease infinite; - -webkit-animation: imagelightbox-loading .5s ease infinite; - animation: imagelightbox-loading .5s ease infinite; - - background-color: #fff; - height: 20px; - width: 20px; - } -} - -@-webkit-keyframes imagelightbox-loading { - 0% { opacity: .5; -webkit-transform: scale(.75); } - 50% { opacity: 1; -webkit-transform: scale(1); } - 100% { opacity: .5; -webkit-transform: scale(.75); } -} - -@-moz-keyframes imagelightbox-loading { - 0% { opacity: .5; -moz-transform: scale(.75); } - 50% { opacity: 1; -moz-transform: scale(1); } - 100% { opacity: .5; -moz-transform: scale(.75); } -} - -@-o-keyframes imagelightbox-loading { - 0% { opacity: .5; -o-transform: scale(.75); } - 50% { opacity: 1; -o-transform: scale(1); } - 100% { opacity: .5; -o-transform: scale(.75); } -} - -@keyframes imagelightbox-loading { - 0% { opacity: .5; transform: scale(.75); } - 50% { opacity: 1; transform: scale(1); } - 100% { opacity: .5; transform: scale(.75); } -} - -#imagelightbox-overlay { - background: #fff; - background: rgba(255, 255, 255, .9); - bottom: 0; - left: 0; - position: fixed; - right: 0; - top: 0; - z-index: 9998; -} - - -// Close button -#imagelightbox-close { - @include border-radius(50%); - - - background-color: #666; - height: $closebutton-size; - position: fixed; - right: $closebutton-size; - text-align: left; - text-indent: -9999px; - top: $closebutton-size; - -moz-transition: color .3s ease; - -ms-transition: color .3s ease; - -o-transition: color .3s ease; - -webkit-transition: color .3s ease; - transition: color .3s ease; - width: $closebutton-size; - z-index: 10002; - - &:hover { - background-color: #111; - } - - &:before, - &:after { - background-color: #fff; - bottom: 20%; - content: ''; - left: 50%; - margin-left: -1px; - position: absolute; - top: 20%; - width: 2px; - } - - &:before { - @include rotate(45deg); - } - - &:after { - @include rotate(-45deg); - } -} - #imagelightbox-caption { background-color: #666; bottom: 0; @@ -146,8 +35,8 @@ html { // The nav bubbles #imagelightbox-nav { - @include border-radius(20px); - @include translateX(-50%); + border-radius: 20px; + translateX: -50%; background-color: #444; background-color: rgba(0, 0, 0, .5); @@ -158,7 +47,7 @@ html { z-index: 10001; a { - @include border-radius(50%); + border-radius: 50%; border: 1px solid #fff; display: inline-block; height: 20px; @@ -171,9 +60,6 @@ html { } } -#imagelightbox-loading, -#imagelightbox-overlay, -#imagelightbox-close, #imagelightbox-caption, #imagelightbox-nav { -moz-animation: fade-in .25s linear; @@ -182,31 +68,12 @@ html { animation: fade-in .25s linear; } -@-webkit-keyframes fade-in { - 0% { opacity: 0; } - 100% { opacity: 1; } -} - -@-moz-keyframes fade-in { - 0% { opacity: 0; } - 100% { opacity: 1; } -} - -@-o-keyframes fade-in { - 0% { opacity: 0; } - 100% { opacity: 1; } -} - @keyframes fade-in { 0% { opacity: 0; } 100% { opacity: 1; } } @media only screen and (max-width: 660px) { - #imagelightbox-close { - right: 20px; - top: 20px; - } #imagelightbox-nav { bottom: 20px; -- cgit v1.2.3