unveil icon indicating copy to clipboard operation
unveil copied to clipboard

Sometimes it's not working unless I scroll ...

Open arkan opened this issue 11 years ago • 13 comments

Hi,

Sometime when I load the page, the images are not "unveiled" unless I manually scroll the page.

It's not every times but I would say 50%.

Any idea why ?

arkan avatar Oct 12 '13 16:10 arkan

If that can helps, I've switched to the the lazyload plugin, and I had the same issue unless I set skip_invisible: false.

https://github.com/tuupola/jquery_lazyload/issues/138

arkan avatar Oct 12 '13 17:10 arkan

Setting width on the img solved this for me.

lkarsten avatar Oct 28 '13 22:10 lkarsten

It is Webkit-related issue. (Tested on Chrome+Safari/Mac.)

When images are in viewport, Unveil doesn't load them unless user scrolls or reloads page.

machal avatar Feb 06 '14 13:02 machal

how can i fix the webkit-related issue?

hayzenbairg avatar Jun 21 '14 14:06 hayzenbairg

Any information?

LasseRafn avatar Sep 30 '14 13:09 LasseRafn

I found a solution!

Set image height and width () and you should be good :+1:

LasseRafn avatar Sep 30 '14 13:09 LasseRafn

Yes, setting width and height seems to work! I'm using this plugin along side ImageResizer and it works great :)

tonygustafsson avatar Nov 06 '14 08:11 tonygustafsson

To me, the issue is not random, but specifically when I refresh the page. First load always work.

maxtoroq avatar Jan 21 '15 02:01 maxtoroq

I experienced this too on WebKit browsers. I moved unveil() in $(window).load() instead of $(document).ready() and that seems to have done the trick. I think it was being called before rendering was finished and the container size was realized:

    <script type="text/javascript">
        $(window).load(function() {
            $('img.unveil').unveil(200);
        });
    </script>

(In my case the images have a percentage width and auto height, so I couldn't do the explicit height and width workaround.)

npiasecki avatar Jan 26 '15 17:01 npiasecki

@npiasecki The loading image needs explicit height and width, not the actual image. I do this:

img.lazy { 
   width: 120px;
   height: 90px;
}
$('img.lazy').unveil(200, function () {
   $(this).removeClass('lazy');
});

maxtoroq avatar Jan 26 '15 17:01 maxtoroq

@maxtoroq Thanks for the hint!

Needed to set dimensions in CSS to make unveil work in latest Chrome.

fnagel avatar Jul 16 '15 08:07 fnagel

I am a little late, but if you know 'approximately' how many image you can force them to be displayed using trigger(). I have a grid and I know that a max of 9 images are displayed when the page is first loaded:

$('img.img-circle').slice(0, 9).trigger('unveil');

daviddoliver avatar Dec 10 '15 18:12 daviddoliver

you could also try to let browser finish any dom related work before executing unveil, that is initializing unveil in a

setTimeout(function () {

}, 0);

fadomire avatar Dec 11 '15 18:12 fadomire