سؤال

I'm using Rhinoslider on my site, the used images have different sizes and I want the slider to adapt to each Image height.

The slider markup is like this:

#Slider

  • .rhino-item
    • img
  • .rhino-item .rhino-active
    • img
  • .rhino-item
    • img

I'm calling a function if you click the next button

var ImageHeight = $('.rhino-active').next('.rhino-item').next('img').outerHeight();
// alert( ImageHeight );
$('#Slider').css('height', ImageHeight);

I also tried

    var ImageHeight = $('.rhino-active').next('.rhino-item img').outerHeight();
// alert( ImageHeight );
$('#Slider').css('height', ImageHeight);

But the result for height is always "null" so I think the function isn't finding the img?

Can someone please help me?

Thx in advance

هل كانت مفيدة؟

المحلول

This should work: $('.rhino-active').next('.rhino-item').children('img').height();

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top