- button
- half-transparent-border
- multiple-borders
- callout
- extended-bg-position
- inner-rounding
- stripes
- gridding
- polka
- checkerboard
- marching-ants
- footnote
- ellipse
- half-ellipse
- parallelograms-pseudo
- diamond-images
- bevel-corners-gradients
- scoop-corners
- trapezoid-tabs
- pie-static
- shadow
- color-tint-filter
- frosted-glass
- folded-corner
- hypenation
- line-breaks
- zebra-lines
- tab-size
- ampersands
- underlines
- text-effects
- circular-text
- cursor
- hit-area
- checkboxes
- weaken-background-by-shadow
- weaken-background-by-blur
- scrolling-hints
- image-slider
- intrinsic-sizing
- table-column-widths
- styling-sibling-count
- fluid-fixed
- vertical-centering
- sticky-footer
- bounce
- elastic
- frame-by-frame
- text-blink
- text-typing
- state-animations
- circular
文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
image-slider
<style>
.image-slider {
position: relative;
display: inline-block;
}
.image-slider > div {
position: absolute;
top: 0;
bottom: 0;
left: 0;
width: 50%;
overflow: hidden;
}
.image-slider img {
display: block;
user-select: none;
}
.image-slider input {
position: absolute;
left: 0;
bottom: 10px;
margin: 0;
filter: contrast(.5);
mix-blend-mode: luminosity;
width: 50%;
transform: scale(2);/* 50% * 2 = 1,for fitts' law */
transform-origin: left bottom;
}
</style>
<div class="image-slider">
<img src="39-image-slider/my_icon_grey.jpg" alt="Before"/>
<img src="39-image-slider/my_icon.jpg" alt="After"/>
</div>
<script>
function $$(selector, context) {
context = context || document;
var elements = context.querySelectorAll(selector);
return Array.prototype.slice.call(elements);
}
$$('.image-slider').forEach(function (slider) {
var div = document.createElement('div');
var img = slider.querySelector('img');
slider.insertBefore(div, img);
div.appendChild(img);
var range = document.createElement('input');
range.type = 'range';
range.oninput = function () {
div.style.width = this.value + '%';
};
slider.appendChild(range);
});
</script>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论