talkbubble 스타일이 지정된 div-box를 클릭하면 색상이 완전히 변경됩니다. 여기서 볼 수 있듯이 자바로 의사 요소 컨트롤
나는, 내가 실제로 요소의 나머지 부분과 색상을 변경합니다 (talkbubble에 대한 화살표를 형성하는 )를 사용하고있어:before
의사 요소를지고의 문제로 실행 : HTML
<div class="clickables">
<div class="talkbubble">
<input type="hidden" class="tbselector" value="sbselection_1">
<div class="thumbnail">
<img src="images/thumbnail1.png" height="33" width="30" />
</div>
<div class="words">Commons</div>
</div>
<div class="talkbubble">
<input type="hidden" class="tbselector" value="sbselection_2">
<div class="thumbnail">
<img src="images/thumbnail1.png" height="33" width="30" align="middle" />
</div>
<div class="words">crossroads</div>
</div>
.
. More and more
.
</div>
</div>
CSS그냥 관련
,451,515,.talkbubble {
background: white;
color: rgb(0,0,0);
height: 40px;
margin-top: 1%;
margin-left: 48%;
margin-right: auto;
position: relative;
width: 150px;
}
.talkbubble:before {
border-top: 10px solid transparent;
border-right: 10px solid white;
border-bottom: 10px solid transparent;
content:"";
height: 0;
position: absolute;
right: 100%;
top: 10px;
width: 0;
}
.talkbubble:before.clicked {
border-right-color:#666666;
}
.talkbubble:hover{
background-color: rgb(194,194,194)!important;
color:rgb(255,255,255);
}
.talkbubble:hover:before{
border-right-color: rgb(194,194,194)!important;
}
JQUERY 여기
$('.clickables').on('click','.talkbubble',function() {
$(this).parent().find('.talkbubble').css('background-color','#ffffff');
$(this).css('background-color', '#666666');
});
내가 몇 가지 연구를 데모 http://jsfiddle.net/petiteco24601/3xuuq2fx/
이며 약간의 결정적 보인다. 대부분의 경우, 내가 발견 한 많은 것은 기본적으로 pseudo 요소가 실제로 존재하지 않기 때문에 의사 요소에 실제로 javascript를 강제 적용 할 수있는 방법이 없다고 기본적으로 말합니다.
그러나 더 많은 연구를 통해 및 Change an HTML5 input's placeholder color with CSS과 같은 버그가 발견되었으며 이러한 버그는 수정되었으며 일부 브라우저에서는 의사 요소에 javascript를 사용할 수 있다고합니다. 실제 거래는 무엇입니까? 사람이 의사 요소를 얼마나 광범위하게 제어 할 수 있습니까?
방금 추가 클래스를 추가하면 인라인 스타일은 모범 사례가 아닙니다 ... – supernova