I am trying to implement, grid system, where if I click on one of the divs, it zooms in while the other divs fades out.
How do I select both these elements separately so that
- Current click div zooms in
- Rest of the elements fades out
var slider= $('.image_slide');
slider.on('click', function(){
slider.css('opacity', 0);
});
.slider_images{
height:200px;
width:200px;
}
.image_slide{
padding:40px;
display:block;
background-color:#555;
width: 40%;
margin-top:20px;
color:white;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="slider_images>
<a href= "#" class="image_slide">IMAGE 1 </a>
<a href= "#" class="image_slide">IMAGE 2 </a>
<a href= "#" class="image_slide">IMAGE 3 </a>
<a href= "#" class="image_slide">IMAGE 4 </a>
</div>
Here by clicking one of the divs, I would like the clicked div to zoom in while others disappear. How can Javascript and Jquery capture the current click event while selecting other elements to do another interaction?
Thanks