Comments (21)
wouldn't that be easily achieved by calling .trigger('unveil') on lets say the images that the sorting/filtering script has shown?
from unveil.
Thank you, but does not that includes writing a script for detecting images that are on view-port? What I meant is unveil should be aware of which images to load, by triggering or automatically.
Please take a look at this similar project and similar request: tuupola/lazyload#58
from unveil.
Hmm yeah i guess it isn't that simple as a thought it was.
from unveil.
You can trigger unveiling of visibile images with: $(window).trigger('scroll')
from unveil.
$("img:visible").trigger( "unveil" )
from unveil.
I'm wrestling with this also. The images in the viewport do not load on iOS Safari until a scroll occurs. The proposed workarounds don't seem to work. @MarkReeder's idea doesn't cause the images to be loaded on iOS Safari and @Yahasana's idea loads all of the images as if they are all visible.
The logic for detecting whether the image is within the viewport is within the private function unveil
so I guess that just needs to be exposed somehow.
from unveil.
I have this horrible workaround working in iOS Safari. It's horrible because it uses a timer to fire code that is a duplicate of what already exists within the plugin. Also, the length of the timer is unreliable—a timer of 10ms doesn't work, for example, and sometimes 100 doesn't work. I'm not sure what that is based on, but possibly image loading time?
// set a threshold
var th = 200;
// apply unveil behaviour to images
var images = $('img');
images.unveil( th );
// force iOS Safari to load images that are visible on page load
setTimeout( function() {
inview = images.filter(function() {
var $e = $(this),
wt = $w.scrollTop(),
wb = wt + $w.height(),
et = $e.offset().top,
eb = et + $e.height();
return eb >= wt - th && et <= wb + th;
});
inview.trigger("unveil");
},100);
from unveil.
Thank you guys for all your ideas. Joeldbirch's solution is a good pointer, but as he mentions, we need to get rid of the timer.
from unveil.
@ErtugKaya, @joeldbirch, Sorry "I'm late to the party", but here's my feedback:
You could extend jQuery with an :inview
selector and then do the following after a filter as been applied:
$("img:inview").trigger("unveil")
You can grab the code for this selector from this gist.
Doing this through unveil is fairly simple as well. You can grab the "forked" code from this fiddle.
Then you could simply do the following whenever you want to show all the visible images in the viewport:
$(window).trigger("unveil")
from unveil.
Thanks @luis-almeida. This certainly seems like it will help, but I wonder if you have any input on the iOS issue? The code you've added here probably still doesn't address that, or maybe I'm missing something. And I guess this should be moved to its own, separate issue.
from unveil.
@joeldbirch are you initializing unveil
after the document is ready?
I'm sorry but I'm not really understanding what the problem with iOS is.
Could you please open a separate issue with the description of the problem and a way to reproduce?
from unveil.
Yes, initialising on document ready (or even window load) does not unveil images in iOS Safari until the user manually triggers a scroll event. I'll open a separate issue and provide a test case as soon as I can. Thanks again.
from unveil.
Hmmmm... Then it's a bug and I have to take a better look at it.
Thanks!
from unveil.
Actually, it looks like #20 is the same bug and has a pull request with a possible fix!
from unveil.
Maybe I got too excited there. Not sure the patch submitted is a proper fix.
from unveil.
I don't think that running unveil
on load
might fix it.
I have to take a better look at the problem.
from unveil.
Hello,
I am having the same issue as the original poster. I am wondering since this thread is a few months old if there is a updated way of addressing content that gets filtered, or if using $("img:inview").trigger("unveil") is the only way at this point? I am currently using it, but I am finding it still doesn't work properly. Some images are in view but aren't shown until I scroll.
Thanks!
from unveil.
I am having the same issue. I use Isotope to filter images. When window finish loading, the images will not show until scroll. When filter apply, it will not show until I scroll...
from unveil.
any updates on this? I ran into this exact same problem... On page load, images don't load, I find I need to scroll to trigger unveil. Any cross-browser way to trigger unveil on only images in viewport on page load?
from unveil.
@zachcarroll It seems as though you can add a load.unveil to the .on() function to fix the problem where your images don't load until you scroll like this
$w.on("scroll.unveil resize.unveil lookup.unveil load.unveil", unveil);
instead of the original
$w.on("scroll.unveil resize.unveil lookup.unveil", unveil);
let me know if this was a suitable solution
from unveil.
Tyler,
Thank you very much. My attention has shifted elsewhere for the time being, but when I get back to this project I will definitely reach back out to you to let you know how it went. Thanks for your time on this!
Best,
Zach
On Jul 29, 2014, at 8:54 AM, Tyler Hall [email protected] wrote:
@zachcarroll It seems as though you can add a load.unveil to the .on() function to fix the problem where your images don't load until you scroll like this
$w.on("scroll.unveil resize.unveil lookup.unveil load.unveil", unveil);
instead of the original$w.on("scroll.unveil resize.unveil lookup.unveil", unveil);
let me know if this was a suitable solution—
Reply to this email directly or view it on GitHub.
from unveil.
Related Issues (20)
- jQuery 1.8+ : Update doc for the callback example HOT 1
- the same img won't cached ?
- loading images using CSS class
- On/Off Unveil
- How to check if all images are loaded HOT 1
- Is it possible to use unveil.js for horizontal scrolling? HOT 1
- Spinner + Ease-in transition
- Fix for scrolling fast to the bottom of the page
- $(this).load(function() HOT 2
- Demo img broken HOT 1
- content reloading issue with iPhone6 and iPhone6 Plus
- When refreshing from halfway down page, unveil doesn't reveal unless page is scrolled up HOT 2
- Non Body Scroll doesn't load. HOT 4
- Question: svg image tags
- [Bug] Unveil.js remove http or https from url HOT 1
- sometimes the images aren't loaded and browser shows error icon until the page is scrolled HOT 4
- Picture element + different formats HOT 1
- How to use unveil with background images in the div with style tags?
- https://www.google.com/search?client=safari&hl=en-US&sxsrf=AOaemvIGDwXYs7FLguEK26G0s1p0xiRvQw:1637725269722&q=%3Cscript%3E+var+myrawlazy+%3D+new+lazy+loading();+of+(!myrawlazy.supports+observer+%26%26+typeof+jquery+!%3D%3D+%27undefined%27+%26%26+typeof+jquery(document).ready+%3D%3D%3D+%27function%27)+%7B+jquery(document).ready(function+()&spell=1&sa=X&ved=2ahUKEwjzlsOHirD0AhXWHDQIHdBEDbsQBSgAegQIARAF&biw=375&bih=553&dpr=2
- Hello/world
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unveil.