레일 앱에 루비를 만들고 5 개의 이미지가 한 줄에 나란히 표시됩니다. 마우스를 올려 놓으면 이미지의 너비가 증가합니다. 이미지 ... 이제 너비가 작동하지만 문제는 마지막 이미지가 다른 이미지로 이동했을 때입니다. 나는 Z- 인덱스를 추가하기 위해 많은 방법을 시도했지만 헛된 ... z를 추가 해보십시오. 스크립트에서와 CSS에서 상대 위치를 좀 더 방법하지만 여전히 지금 여기 작업에 -index 내 home.html.erb입니다 :z-index가 joverery에서 호버 너비 효과로 작동하지 않습니다.
<div class="container-fluid" id="width-r">
<%= image_tag("wood1.jpg",class: "this h-h") %>
<%= image_tag("wood2.jpg",class: "this") %>
<%= image_tag("wood3.jpg",class: "this") %>
<%= image_tag("wood4.jpg",class: "this") %>
<%= image_tag("wood5.jpg",class: "this") %>
</div>
<div class="jumbotron">
<h1 align="center"> Here comes the ads</h1>
</div>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".this").mouseover(function(){
$(this).animate({width: "25%"},"fast");
});
$(".this").mouseout(function(){
$(this).animate({width: "20%"},"fast");
});
});
</script>
여기 내 CSS/SCS들 파일입니다
@import "bootstrap-sprockets";
@import "bootstrap";
.navbar {
background-color: #fff;
}
body {
height: 100%;
}
.this {
width: 20%;
float: left;
height: 581.55px;
}
.navbar-ma {
/* remove space between the navbar and the images below */
margin-bottom: 0px;
}
.jumbotron {
height: 220px;
margin-bottom: 0px;
}
.container-fluid {
padding: 0px;
}
물론 !! 5 * 20 % = 100 % 또는 4 * 20 % + 25 % = 105 % 이것은 마지막 공간을위한 공간이 작음을 의미합니다! –
예 알아요. 대신에 z-index를 다른 이미지보다 높게 가져 오는 이미지를 원합니다. – sam0101
왜이 경우 더 높은 z- 인덱스를 사용하지 않을까요? –