Hi all,

The following piece of js code in views_nivo_slider.js

// Fix sizes
vns.data('hmax', 0).data('wmax', 0);
     $('img', vns).each(function () {
                    $(this).load(function () {
                        hmax = (vns.data('hmax') > $(this).height()) ? vns.data('hmax') : $(this).height();
                        wmax = (vns.data('wmax') > $(this).width()) ? vns.data('wmax') : $(this).width();

                        vns.width(wmax).height(hmax).data('hmax', hmax).data('wmax', wmax);
                    });
       });

causes nivo slider 3.x not to be responsive as it should be.

Commenting the above script (that writes img width and height in inline styles) nivo slider becames responsive.

Can this be fixed please?

Thak you very much

Comments

podarok’s picture

Status: Active » Needs work

You can upload patch in git diff format http://drupal.org/patch with needs review status and everything will be possible ))

ckng’s picture

Please have extensive tests, that piece of code has been since 2011, if any it will break a lot of existing sites.

If not mistaken it was there to fix image field does not output dimension information on img tag. I'm not sure if it is still the same case. Or probably related to #1848350: The slider doesn't work on Chrome

ckng’s picture

Would suggest the alternative to force responsive css code to use !important if necessary.
width: 100% !important;

dqd’s picture

Issue summary: View changes

... if, then, rather "auto" than "100%", including height to prevent unwanted image cropping.

.views-nivo-slider {
  width: auto !important;
  height: auto !important;
}

But this solution - all in all - is not really smart. Especially because it resets the default js code from above anyway, so if #1848350: The slider doesn't work on Chrome is the reason we want to keep the js code in, the issue would persist and come back this way anyway too.

webmaster@snpthai’s picture

I applied code a estimate this...

   vns.data('hmax', 0).data('wmax', 0);
    $('img', vns).each(function () {
      hmax =  (vns.data('hmax') > $(this).height("100%")) ? vns.data('hmax') : $(this).height("100%");//351
      wmax =  (vns.data('wmax') >  $(this).width("100%"))? vns.data('hmax') : $(this).width("100%");
      vns.width(wmax).height(hmax).data('hmax', hmax).data('wmax', wmax);
    });
podarok’s picture

Status: Needs work » Patch (to be ported)
docans’s picture

Has this patch been ported

neograph734’s picture

I suppose podarok wants someone to transform the code on these pages in to a git patch file (patch to be ported). Since there is no such file, the answer is probably no.

vipul tulse’s picture

I have made it using simple css media queries style

here is example: http://www.energizect.com/your-home

And its easy to use media queries only for View Neo or NEO slider responsiveness.

selva8187’s picture

Hi Guys,

Thanks you diqidoq . #4 working smart.