UNPKG

iv-viewer

Version:

A zooming and panning plugin inspired by google photos for your web images.

217 lines 4.06 kB
.iv { /***** snap view css *****/ /*** zoom actions ***/ /**** snap view css end *****/ } .iv-container { overflow: hidden; position: relative; -webkit-user-select: none; -moz-user-select: none; user-select: none; } .iv-fullscreen { position: fixed; background: #0d0d0d; width: 100%; height: 100%; top: 0; left: 0; display: none; z-index: 1000; } .iv-fullscreen-container { position: relative; height: 100%; width: 100%; } .iv-fullscreen-close { position: absolute; width: 24px; height: 24px; right: 10px; top: 10px; padding: 10px; cursor: pointer; text-align: center; overflow: hidden; text-shadow: 0 0 3px #6d6d6d; transition: all ease 200ms; } .iv-fullscreen-close:after, .iv-fullscreen-close:before { content: ""; height: 4px; width: 24px; background: #fff; position: absolute; top: 50%; left: 50%; } .iv-fullscreen-close:before { transform: translate(-50%, -50%) rotate(45deg); } .iv-fullscreen-close:after { transform: translate(-50%, -50%) rotate(-45deg); } .iv-fullscreen-close:hover { transform: rotate(90deg); transform-origin: 50% 50%; } .iv-snap-view { width: 150px; height: 150px; position: absolute; top: 20px; border: 1px solid #aaa; background: black; z-index: 100; box-sizing: content-box; transition: opacity ease 400ms; opacity: 0; left: 20px; } .iv-snap-image-wrap { display: inline-block; position: absolute; max-width: 150px; max-height: 150px; top: 50%; left: 50%; transform: translate(-50%, -50%); overflow: hidden; } .iv-snap-image { position: relative; touch-action: none; } .iv-snap-handle { box-sizing: border-box; position: absolute; border: 1px solid #aaa; transform: translate3d(0, 0, 0); box-shadow: 0 0 0 200px rgba(0, 0, 0, 0.5); cursor: pointer; cursor: grab; } .iv-snap-handle:active { cursor: grabbing; } .iv-zoom-actions { width: 100%; box-sizing: content-box; position: absolute; top: 150px; left: -1px; height: 20px; border: 1px solid #aaa; border-top: 0; background: rgba(0, 0, 0, 0.3); } .iv-zoom-actions--has-buttons .iv-zoom-slider { left: 24px; right: 24px; } .iv-zoom-handle { width: 20px; height: 20px; background: #fff; position: absolute; cursor: pointer; cursor: grab; } .iv-zoom-handle:active { cursor: grabbing; } .iv-zoom-slider { box-sizing: inherit; position: absolute; top: 0; bottom: 0; left: 0; right: 0; } .iv-button-zoom, .iv-button-zoom--in, .iv-button-zoom--out { position: absolute; top: 0; bottom: 0; width: 24px; cursor: pointer; display: flex; align-items: center; justify-content: center; } .iv-button-zoom:before, .iv-button-zoom--in:before, .iv-button-zoom--out:before, .iv-button-zoom:after, .iv-button-zoom--in:after, .iv-button-zoom--out:after { content: ""; height: 2px; width: 10px; background: #fff; position: absolute; } .iv-button-zoom--in { right: 0; } .iv-button-zoom--in:after { transform: rotate(90deg); } .iv-button-zoom--out { left: 0; } .iv-image-mode { display: inline-block; } .iv-image-view { position: absolute; height: 100%; width: 100%; top: 0; left: 0; } .iv-image-wrap { display: inline-block; } .iv-image-wrap:active { cursor: move; } .iv-image { max-width: 100%; max-height: 100%; position: absolute; touch-action: none; transform: translate3d(0, 0, 0); } .iv-loader { top: 50%; left: 50%; border-radius: 50%; width: 32px; height: 32px; z-index: 100; margin-top: -16px; margin-left: -16px; font-size: 5px; position: absolute; text-indent: -9999em; border: 1.1em solid rgba(0, 0, 0, 0.2); border-left: 1.1em solid #fff; transform: translateZ(0); animation: loading-icon 1.1s infinite linear; } .iv-loader:after { width: 10em; height: 10em; border-radius: 50%; } @keyframes loading-icon { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } @media screen and (max-width: 767px) { .iv-snap-view { z-index: -1; visibility: hidden; } }