【发布时间】:2015-03-30 23:51:50
【问题描述】:
我有一组不同不透明度的多个圆圈,每个圆圈都应该是可点击的,当点击时,应该成为焦点,点击的会出现在其他圆圈的前面。
你会说简单...
我的问题是使用 CSS 或 Jquery 以及如何实现它
例子:
.circles{}
.round{opacity: 0.4;;width:75px;height:75px;border-radius: 50%; position: relative;}
.circle1{background:#0f4977;top: 35px;left: 200px;z-index: 1;}
.circle2{background:#f41875;top: 0px;left: 250px;z-index: 2;}
.circle3{background:#6b259c;top: -50px;left: 205px;z-index: 3;}`
$(".round").click(function() { //on click of any circle
$(this).css("z-index", "99");
$(this).css("opacity", "1");
$(this).siblings().css("opacity", "0.5");
$(this).siblings().css("z-index", "5");
});
<div clas="circles">
<div class="round circle1"></div>
<div class="round circle2"></div>
<div class="round circle3"></div>
</div>
【问题讨论】:
-
您的问题是什么,您目前拥有的代码在哪里?我不确定您的问题是否会受到好评,因为 SO 不是代码编写服务。请提供您的代码和您尝试过的内容并描述您的代码遇到的问题
-
这段代码在你的本地不工作吗?小提琴缺少 jquery,但代码看起来不错