我有一个问题,实际上对我来说很难定义,很抱歉主题名称。谈到这个问题......我几乎没有彼此相邻的输入。喜欢:
<input type="radio" name="radio-set" id="st-control-2"/>
<a href="#"></a>
<input type="radio" name="radio-set" id="st-control-3"/>
<a href="#"></a>
<input type="radio" name="radio-set" id="st-control-4"/>
<a href="#"></a>
<input type="radio" name="radio-set" id="st-control-5"/>
<a href="#"></a>
在CSS中
input#st-control-3:checked ~ input {
left:-200%; }
input#st-control-3:checked ~ a {
left:-200%; }
我想通过点击例如 #st-control-3 来移动其他输入。它有效,但仅适用于#st-control-3 之后编写的元素(在我的例子中是输入),因此在我的示例中,效果不会出现在#st-control-2 上。
所以问题是如何影响非parent或child并且写在active元素之前的元素。
我希望我写的很清楚。
最佳答案
好的,我将类添加到 ,因为我需要一个 来保留,我是通过 JS 使用代码完成的:
$(document).ready(function(){
$("#st-control-3").click(function(){
$(".panel").css('left','-200%');
});
});
一切正常,但我对“后退按钮”有问题...如何创建下一个将 .panel 返回到默认位置的函数?
关于html - 检查 div 影响它之前写的其他 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30108158/