Tag: html5

HTML lazy image loading

Adding lazy image loading to Hugo's figure shortcode

3 minute read

The HTML <img /> tag has this handy attribute loading="lazy" that enables lazy image loading, so that images are only loaded whenever the user scrolls all the way down to their position. This makes page loading super-fast, and reduces the amount of wasted bandwidth, especially when browsing from page to page. In the past this was achieved by a few lines of custom JavaScript code, but it is supported by all major browsers, both for PC and mobile. It should always be used unless there’s a very good reason not to, to the point where it can probably be argued that it should be the default behavior of images.

1 minute read

HTML5 Snake Game

HTML5 Snake Game

Lately, I have been messing around with a snake game written in HTML5+js. A great deal of parameters can be modified in real time using an input form in the same page, such as the width and length of canvas, cell shape, background colour, food colour, snake colour and the speed of the game. Also, I posted the full javascript code.

If you are interested, you can check the results here.

Website design by myself. See the privacy policy.
Content licensed under CC-BY-NC-SA 4.0 .