I am trying to vertically center all my images with a height less than 531 pixels within my cycles:
before : function(currSlideElement, nextSlideElement, options, forwardFlag){
foto = $(nextSlideElement).find('img');
alert(foto.height());
if(foto.height() < 531){
foto.css('margin-top', 266 - (foto.height()/2));
}
},
However, the alert always returns "0" for the first element, causing it to have a margin top of 266px regardless of its actual size.
I have already tried using before
and switching between currSlideElement
and nextSlideElement
, as well as using after
.
What could be the issue here?