私は以下のコードにJavascriptを適用すると、それは最初の画像サイズが変化しても、私のマウスはどのようにループ内でマウスをホバーしている間に画像サイズを変更しますか?
<div class="container">
<div class="row">
@foreach($gigs as $gig)
<div class=" col-lg-3 col-md-3 col-sm-6 col-xs-12 gigbox">
<div class="panel panel-default" style="height: 285px">
<img src="{{URL::asset($gig->image)}}" id="img" width="100%" onmouseover="changesize()" height="160" alt="">
<ul class="skillUl">
<li class="gigtitle" style="list-style: none"><a href="{{route('gig',['gig_id'=>$gig->id, 'gig_title'=>$gig->gigtitle])}}"> I will {{$gig->gigtitle}}</a></li>
<a class="startingFrom" href="{{route('gig',['gig_id'=>$gig->id, 'gig_title'=>$gig->gigtitle])}}">Starting From <Span class="price"> Rs {{$gig->price}}</Span></a>
</ul>
</div>
</div>
@endforeach
</div>
</div>
JavaScriptコードはここに
<script>
function changesize() {
document.getElementById("img").style.width = "130px";
}
</script>
IDは一意である必要があります... クラスを使用するか、CSSで設定してくださいimg:hover ... transform scale –
私のためにコードを書いてください。私はウェブで新しいです –
あなたのCSSの最後にCSSサンプルを入れてください... –