私はレールアプリケーションでルビーを作成していますが、私は5行のイメージを1行に並べています...私が上に移動するとイメージの幅を広げたいイメージ...幅が問題なく動作していますが、画像にカーソルを置いたときに最後の画像が別の場所に移動する問題があります。Zインデックスを追加するために多くの方法を試しましたが、無駄にしています... zを追加してみてくださいスクリプトからとCSSからの相対位置と、いくつかのより多くの方法が、それでも今ここ を働いて-indexは私home.html.erbです:jqueryでz-indexがホバリング幅の効果で動作しない
<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/SCSSファイルです:
@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インデックスを得るようにしたいと考えています。 – sam0101
なぜ、より高いzインデックスがこの場合役に立たないことを望みますか? –