diff --git a/src/css/viewer.css b/src/css/viewer.css index 0263899..e4aa7d2 100644 --- a/src/css/viewer.css +++ b/src/css/viewer.css @@ -217,55 +217,55 @@ } .viewer-toolbar { - & ul { + & > ul { display: inline-block; margin: 0 auto 5px; overflow: hidden; padding: 3px 0; - } - & li { - background-color: rgba(0, 0, 0, .5); - border-radius: 50%; - cursor: pointer; - float: left; - height: 24px; - overflow: hidden; - transition: background-color .15s; - width: 24px; + & > li { + background-color: rgba(0, 0, 0, .5); + border-radius: 50%; + cursor: pointer; + float: left; + height: 24px; + overflow: hidden; + transition: background-color .15s; + width: 24px; - &:hover { - background-color: rgba(0, 0, 0, .8); + &:hover { + background-color: rgba(0, 0, 0, .8); + } + + &::before { + margin: 2px; + } + + & + li { + margin-left: 1px; + } } - &::before { - margin: 2px; + & > .viewer-small { + height: 18px; + margin-bottom: 3px; + margin-top: 3px; + width: 18px; + + &::before { + margin: -1px; + } } - & + li { - margin-left: 1px; - } - } + & > .viewer-large { + height: 30px; + margin-bottom: -3px; + margin-top: -3px; + width: 30px; - & .viewer-small { - height: 18px; - margin-bottom: 3px; - margin-top: 3px; - width: 18px; - - &::before { - margin: -1px; - } - } - - & .viewer-large { - height: 30px; - margin-bottom: -3px; - margin-top: -3px; - width: 30px; - - &::before { - margin: 5px; + &::before { + margin: 5px; + } } } } diff --git a/src/css/viewer.scss b/src/css/viewer.scss new file mode 100644 index 0000000..3f3965f --- /dev/null +++ b/src/css/viewer.scss @@ -0,0 +1,422 @@ +.viewer { + &-zoom-in::before, + &-zoom-out::before, + &-one-to-one::before, + &-reset::before, + &-prev::before, + &-play::before, + &-next::before, + &-rotate-left::before, + &-rotate-right::before, + &-flip-horizontal::before, + &-flip-vertical::before, + &-fullscreen::before, + &-fullscreen-exit::before, + &-close::before { + background-image: url('../images/icons.png'); + background-repeat: no-repeat; + color: transparent; + display: block; + font-size: 0; + height: 20px; + line-height: 0; + width: 20px; + } + + &-zoom-in::before { + background-position: 0 0; + content: 'Zoom In'; + } + + &-zoom-out::before { + background-position: -20px 0; + content: 'Zoom Out'; + } + + &-one-to-one::before { + background-position: -40px 0; + content: 'One to One'; + } + + &-reset::before { + background-position: -60px 0; + content: 'Reset'; + } + + &-prev::before { + background-position: -80px 0; + content: 'Previous'; + } + + &-play::before { + background-position: -100px 0; + content: 'Play'; + } + + &-next::before { + background-position: -120px 0; + content: 'Next'; + } + + &-rotate-left::before { + background-position: -140px 0; + content: 'Rotate Left'; + } + + &-rotate-right::before { + background-position: -160px 0; + content: 'Rotate Right'; + } + + &-flip-horizontal::before { + background-position: -180px 0; + content: 'Flip Horizontal'; + } + + &-flip-vertical::before { + background-position: -200px 0; + content: 'Flip Vertical'; + } + + &-fullscreen::before { + background-position: -220px 0; + content: 'Enter Full Screen'; + } + + &-fullscreen-exit::before { + background-position: -240px 0; + content: 'Exit Full Screen'; + } + + &-close::before { + background-position: -260px 0; + content: 'Close'; + } + + &-container { + bottom: 0; + direction: ltr; + font-size: 0; + left: 0; + line-height: 0; + overflow: hidden; + position: absolute; + right: 0; + -webkit-tap-highlight-color: transparent; + top: 0; + -webkit-touch-callout: none; + touch-action: none; + user-select: none; + + &::selection, + & *::selection { + background-color: transparent; + } + + & img { + display: block; + height: auto; + max-height: none !important; + max-width: none !important; + min-height: 0 !important; + min-width: 0 !important; + width: 100%; + } + } + + &-canvas { + bottom: 0; + left: 0; + overflow: hidden; + position: absolute; + right: 0; + top: 0; + + & > img { + height: auto; + margin: 15px auto; + max-width: 90% !important; + width: auto; + } + } + + &-footer { + bottom: 0; + left: 0; + overflow: hidden; + position: absolute; + right: 0; + text-align: center; + } + + &-navbar { + background-color: rgba(0, 0, 0, .5); + overflow: hidden; + } + + &-list { + box-sizing: content-box; + height: 50px; + margin: 0; + overflow: hidden; + padding: 1px 0; + + & > li { + color: transparent; + cursor: pointer; + float: left; + font-size: 0; + height: 50px; + line-height: 0; + opacity: .5; + overflow: hidden; + transition: opacity .15s; + width: 30px; + + &:hover { + opacity: .75; + } + + & + li { + margin-left: 1px; + } + } + + & > .viewer-loading { + position: relative; + + &::after { + border-width: 2px; + height: 20px; + margin-left: -10px; + margin-top: -10px; + width: 20px; + } + } + + & > .viewer-active { + &, + &:hover { + opacity: 1; + } + } + } + + &-player { + background-color: #000; + bottom: 0; + cursor: none; + display: none; + left: 0; + position: absolute; + right: 0; + top: 0; + + & > img { + left: 0; + position: absolute; + top: 0; + } + } + + &-toolbar { + & > ul { + display: inline-block; + margin: 0 auto 5px; + overflow: hidden; + padding: 3px 0; + + & > li { + background-color: rgba(0, 0, 0, .5); + border-radius: 50%; + cursor: pointer; + float: left; + height: 24px; + overflow: hidden; + transition: background-color .15s; + width: 24px; + + &:hover { + background-color: rgba(0, 0, 0, .8); + } + + &::before { + margin: 2px; + } + + & + li { + margin-left: 1px; + } + } + + & > .viewer-small { + height: 18px; + margin-bottom: 3px; + margin-top: 3px; + width: 18px; + + &::before { + margin: -1px; + } + } + + & > .viewer-large { + height: 30px; + margin-bottom: -3px; + margin-top: -3px; + width: 30px; + + &::before { + margin: 5px; + } + } + } + } + + &-tooltip { + background-color: rgba(0, 0, 0, 0.8); + border-radius: 10px; + color: #fff; + display: none; + font-size: 12px; + height: 20px; + left: 50%; + line-height: 20px; + margin-left: -25px; + margin-top: -10px; + position: absolute; + text-align: center; + top: 50%; + width: 50px; + } + + &-title { + color: #ccc; + display: inline-block; + font-size: 12px; + line-height: 1; + margin: 0 5% 5px; + max-width: 90%; + opacity: .8; + overflow: hidden; + text-overflow: ellipsis; + transition: opacity .15s; + white-space: nowrap; + + &:hover { + opacity: 1; + } + } + + &-button { + background-color: rgba(0, 0, 0, .5); + border-radius: 50%; + cursor: pointer; + height: 80px; + overflow: hidden; + position: absolute; + right: -40px; + top: -40px; + transition: background-color .15s; + width: 80px; + + &:focus, + &:hover { + background-color: rgba(0, 0, 0, .8); + } + + &::before { + bottom: 15px; + left: 15px; + position: absolute; + } + } + + &-fixed { + position: fixed; + } + + &-open { + overflow: hidden; + } + + &-show { + display: block; + } + + &-hide { + display: none; + } + + &-backdrop { + background-color: rgba(0, 0, 0, .5); + } + + &-invisible { + visibility: hidden; + } + + &-move { + cursor: move; + cursor: grab; + } + + &-fade { + opacity: 0; + } + + &-in { + opacity: 1; + } + + &-transition { + transition: all .3s; + } + + @keyframes viewer-spinner { + 0% { + transform: rotate(0deg); + } + + 100% { + transform: rotate(360deg); + } + } + + &-loading { + &::after { + animation: viewer-spinner 1s linear infinite; + border: 4px solid rgba(255, 255, 255, .1); + border-left-color: rgba(255, 255, 255, .5); + border-radius: 50%; + content: ''; + display: inline-block; + height: 40px; + left: 50%; + margin-left: -20px; + margin-top: -20px; + position: absolute; + top: 50%; + width: 40px; + z-index: 1; + } + } + + @media (max-width: 767px) { + &-hide-xs-down { + display: none; + } + } + + @media (max-width: 991px) { + &-hide-sm-down { + display: none; + } + } + + @media (max-width: 1199px) { + &-hide-md-down { + display: none; + } + } +} diff --git a/src/index.scss b/src/index.scss new file mode 100644 index 0000000..b579942 --- /dev/null +++ b/src/index.scss @@ -0,0 +1 @@ +@import './css/viewer.scss';