I'm adding a class with jQuery when a user click on a thumbnail to give an animation effect with the margin-top property but it doesn't seem to be working and i'm not sure why so i'm wondering someone could explain it to me. code below:
CSS:
.content {
position: relative;
width: 60%;
height: auto;
transition: all 200ms ease-in-out; }
.content img {
margin-top: -150px;
width: 100%;
height: auto;
transition: all 900ms ease-in-out; }
.content img.img-is-showing {
margin-top: 0; }
JS:
$(document).ready(function(){
$('.lightbox-trigger').on('click', function(){
var image_href = $(this).attr('href');
$('.lightbox').addClass('is-showing');
$('.content img').addClass('img-is-showing');
$('.lightbox-image').attr('src', image_href);
$('.lightbox').show();
$('.lightbox').on('click', function(){
$(this).removeClass('is-showing');
});
});
});
I have done the same type of animation using the opacity property on the ".lightbox" class and it's working fine but I'm not sure why the margin-top animation won't work.
The url for the site is Here