5 ms·
If you are going to use this, keep in mind the advice given... set the height and width attributes of the image to prevent the page jumping around for lazily lo
by buro9 7y ago
If you are going to use this, keep in mind the advice given... set the height and width attributes of the image to prevent the page jumping around for lazily loaded images.
Which means, if you accept user generated content or images from any CMS or other source you really should be obtaining the image dimensions and using them in the HTML.
- mrspuratic 7y agoThis. It's bad enough already, pages can jump around many times if you start scrolling before they're "done" (which is hard to tell nowadays anyway). News site main pages tend to be the worst. Clicking through to a different article because the page re-rendered under my finger really gets my dander up.
- StavrosK 7y agoIsn't that a thing of the past, with scroll anchoring being a feature of most major browsers?
- gmueckl 7y agoSadly, no. I experience many pages jumokng around wildly. Most often, the culprit seems to be ads that arrive late. Sometimes, it seems like pages are only requesting them when their intended position scrolls into view, so they pop up in the middle of the screen. So the browser must move either the upper half up or the lower half down to make space.
- entropicdrifter 7y agoIt's pretty depressing that so many otherwise modern UIs are totally broken whenever you're not using an ad-blocker
- cptskippy 7y agoI installed NoScript recently and was actually surprised by how many sites actually load low resolution placeholders and then swap them out with high res versions via Javascript. I'm assuming to avoid this jumping around.
- labawi 7y agoThat's probably an effort to load a faster, maybe a leaner version for mobile/whatever. To actually prevent jumping (including on lean image load), I believe it would be more effective to simply set width and height.
- cptskippy 7y agoI think it's a mix but most of the preloads I've encountered aren't just lower resolutions, rather they look like a smear of color. Like someone used a Gaussian blur filter with a 1000x pixel radius.
- Dylan16807 7y agoYeah, I could understand a 128x128 pixel version or something but when it's 10x10 why are you even bothering.
- sidpatil 7y agoI always assumed this a was a dark pattern designed to get people to click on lucrative links swapped in at the last minute.
- eru 7y agoBrownian motion plus commercial (or other) pressure can produce things that look like dark patterns. Very similar to evolution in biology. Assume that developers make essentially random mistakes or changes. Whenever anything happens that has a negative impact on metrics management cares about, there will be pressure to look what went wrong. Any random change that has a benign impact on measured metrics, eg weird page loading that makes people accidentally click on more lucrative links, there will be no pressure to revert. No one needs to consciously look for and implement dark patterns for this to work out. It's very similar to how confirmation bias can make people question news they don't like until they find enough evidence to disregard them; but are just accepting news they do like.
- deleted 7y ago[deleted]
- deleted 7y ago[deleted]
- martin_a 7y agoHow/Why would I do this with responsive/fluid layouts and dynamically changing image sizes?
- martin-adams 7y agoYou would attempt to set some constraints on the image dimensions at the different breakpoints. For example, you can use percentages if you want a fluid amount. It's really to tell the browser how much space to allocate to the image before it's loaded. This is an old problem and pages that jump around would happen on slower connections.
- wruza 7y agoOh, constraints! These cute little math things that always work and are fundamental to the definition of layout geometry. I doubt we’ll ever see them built into a browser, because all nice generalized things never get there.
- martin_a 7y agoOk, my image has 100% width for screens up to 800 px width, what height value do I have to set? You simply don't know this information at the time when the DOM is built. The idea to set fixed dimensions feels like it comes from a time where we did designs with tables and "optimized" sites for 1024 x 768 pixel screen size. That was the time when you could tell that this image should be displayed 200 x 200 px in size and nothing else. And it fit. One way or another.
- martin-adams 7y agoI would approach this thinking in terms of a known aspect ratio of the images and use a technique like this: https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_aspect_ratio_43 https://www.w3schools.com/howto/tryit.asp?filename=tryhow_cs... Make no mistake, this is a silly problem to need to hack a solution for. So I would welcome lazy loaded images with space allocation before it's rendered with a responsive sizing.
- 7y ago
- yread 7y agoDo you mean like when you click on a search result in Google Chrome on Android, then go back want to click the next one but in the meantime an animation starts showing alternative search terms so the click goes there instead? And you don't even need images for it
- RobertRoberts 7y agoThis reminds me of all the icky hacks "everyone" had to do going back years. (remember the star hack?) I am not going to do this. This is such a pervasive issue, and with an _endless_ difference in screen sizes and millions of pages of content... not going to happen. This kind of problem is exactly what the browser is best at solving. A problem everyone has on most pages on the internet.
- throwanem 7y agoRefusing to specify your image sizes denies the browser the information it needs to solve this problem.
- RobertRoberts 7y agoMaybe, but I think this is a solvable problem from the browsers perspective. In my experience building websites the need for image dimensions is near zero. 1. The penalty for not displaying image dimensions is nearly insignificant because almost _all_ images that you would put width/height on are from content managers, not designers. 2. Mobile content: On a phone the content moves down after the image is loaded. (everything is just a single column) Which is a preferable action than a big empty space. So, I prefer _not_ including dimensions on user content for phones. 3. Responsive design: All CSS I have been using for years now has "max-width:100%". Therefore (since a lot of traffic is mobile) most (rough guess) of images loaded from sites I've worked on the image dimensions are recalculated as soon as the image is loaded anyway. 4. Srcset: Multiple possible images downloaded that are _chosen_ by the browser at run time. You already have to provide dimensions. But what if they aren't exact? Go back to #1. 5. Web design: I can't even recall the last time I put an image in a design using the <img> tag that affected layout. (maybe if you go back to the 90s this would have mattered)
- labawi 7y agoInstead of specifying how big your images are in html (or css), you are proposing the browser should magically guess how big your images are going to end up? Or should it not render anything until all your needless images are downloaded? Is there an actual problem in identifying what images correspond to your markup and adding an appropriate attribute? (asking, not a web dev) AFAICT the problem is solved, this is the necessary protocol - not even a bad one, use it and it will work.