슬라이드 쇼를 만들고 있는데 이미지 위의 탐색 버튼을 세로로 가운데에 놓으려고합니다. 나는 top : 50 %를 시도하고 있지만, 슬라이드 쇼의 높이가 아니라 버튼의 높이에 비례하여 움직입니다. jQuery Cycle을 사용하고 있습니다.부모 요소에 요소 가운데 맞추기
<div class="slideshow_container">
<h2>Amor Insecta</h2>
<div class="slideshow_controls">
<div class="cycle_prev"> </div>
<div class="cycle_next"> </div>
</div>
<div class="slideshow">
<img title="stylepageart2.jpg" src="http://cmpltunknwn.mybigcommerce.com/product_images/uploaded_images/stylepageart21.jpg" alt="stylepageart2.jpg" />
<img title="stylepageart3.jpg" src="http://cmpltunknwn.mybigcommerce.com/product_images/uploaded_images/stylepageart22.jpg" alt="stylepageart3.jpg" />
</div>
</div>
.slideshow_container {
width:90%;
margin: 0 auto 50px auto;
max-height:2000px;
}
.slideshow {
position: relative;
width: 100% !important;
}
.slideshow img {
width: 100% !important;
height:auto !important;
position: absolute;
top: 0;
left: 0;
}
.slideshow_controls {
display:none;
width:100%;
height:100%;
position:relative;
z-index:100!important;
}
.cycle_prev, .cycle_next {
position:absolute;
top:50%;
width:37px;
height:37px;
}
.cycle_prev{
left:0;
background:url(http://cmpltunknwn.mybigcommerce.com/product_images/theme_images/prev.jpg) no-repeat;
}
.cycle_next {
right:0;
background:url(http://cmpltunknwn.mybigcommerce.com/product_images/theme_images/next.jpg) no-repeat;
}
문제는 소자 절대 요소로 배치되어있다. 따라서 그들은 유용한 높이를 얻지 못합니다. 내 제안 : 당신의 욕망의 높이를 계산하고 자바 스크립트로 설정하십시오. 그러면 훨씬 쉬울 것입니다. – KittMedia
@KittMedia : 어떻게해야 할 지 알려주시겠습니까? –
가장 쉬운 방법은이 경우'$ ('img'). height();'입니다. – KittMedia