Homemade Source/Css Snippets
[CSS Snippet] 이미지 확대기능 구현하기
반응형
이미지 확대을 CSS Snippet으로 구현
예시
CSS Snippet
@media (hover: hover) {
.image-embed.is-loaded img,
.markdown-preview-view .internal-embed:not(:has(> img)) img {
line-height: 0;
background-color: transparent;
}
img:not(.callout-content img):not(.thumbnailImage):not(
img .community-item-screenshot
) {
max-width: 100%;
cursor: zoom-in;
}
body img:active:not(.callout-content img):not(.thumbnailImage) {
background-color: var(--background-primary);
padding: 10px;
border: 0px;
}
img:not(.callout-content img):not(.thumbnailImage):active {
aspect-ratio: unset;
cursor: zoom-out;
display: block;
z-index: 200;
position: fixed;
max-height: calc(100% + 1px);
max-width: 100%;
height: calc(100% + 1px);
width: 100%;
object-fit: contain;
margin: -0.5px auto 0;
text-align: center;
padding: 0;
left: 0;
right: 0;
bottom: 0;
}
img:not(.callout-content img):not(.thumbnailImage):active::after {
background-color: var(--background-primary);
opacity: 1;
content: " ";
height: calc(100% + 1px);
width: 100%;
position: fixed;
left: 0;
right: 1px;
z-index: 0;
}
img:not(.callout-content img):not(.thumbnailImage):active img {
aspect-ratio: unset;
top: 50%;
z-index: 99;
transform: translateY(-50%);
padding: 0;
margin: 0 auto;
width: calc(100% - 20px);
max-height: 95vh;
object-fit: contain;
left: 0;
right: 0;
bottom: 0;
position: absolute;
opacity: 1;
outline: unset;
outline-offset: 0px;
border-radius: 0;
}
}
img.community-item-screenshot,
.canvas img {
pointer-events: none;
}
관련 플러그인
반응형
'Homemade Source > Css Snippets' 카테고리의 다른 글
[CSS Snippet] 파일 탐색기 폴더 색상 변경하기 (0) | 2024.04.02 |
---|---|
[CSS Snippet] 선택한 텍스트의 색상 변경하기 (0) | 2024.03.29 |
[CSS Snippet] 편집모드에서 현재 줄 강조하기 (0) | 2024.03.24 |
[CSS Snippet] Dialogue 플러그인의 iMessage 스타일 적용하기 (0) | 2024.03.01 |
[CSS Snippet] Task 완료시 취소선 안보이게 하기 (0) | 2024.02.29 |