When an event listener such as a window ‘resize’ fires, sometimes it will fire 72,000 times per second. That means your callback function is also firing 72,000 times in a row, bogging down the browser.
This isn’t as much of a problem as it used to be, but debouncing is still needed and should still be used.
But then let’s say you need to load some images on the fly, and then do something useful AFTER each image is fully loaded.
IOW, maybe you want to adjust the layout of the image modal that pops up, or you want to do something crazy with a caption, or whatever…
If you’ve ever created a website, you’ve surely used jQuery.
But hang on a minute – do you really need jQuery?
The answer is, as usual, complicated… but fascinating!
For example: the self-executing function.
What in the Sam Hill is that all about?!
Chrome 94 was recently released with a new feature: Idle Detection.
Much has been said about the diabolical nature of this new capability in Chrome…
Thing is, while we can be forgiven for doubting Google’s motives in adding this feature, it just so happens that Idle Detection is actually quite safe – and useful!
Until now, apps were for smartphones and tablets. But that’s all about to change with PWAs: Progressive Web Apps!
PWAs are a new(ish) type of app that is web-based.
That means you can use the same app on your phone, tablet, desktop, or laptop – whether you use Windows, linux, or Mac.
Progressive Web Apps also work differently than normal apps, making them a bit more secure and privacy-oriented than traditional native apps.
So, what are these things and how do they work?
Ah yes, the Mobile Revolution!
In desktop web browsers, you generally get a web inspector / debug console that lets you do all kinds of fun stuff, including debugging your JS code.
But on mobile, well, no such luck.
In fact, most mobile browsers give you absolutely nothing! Fortunately, there’s a neat trick that fixes everything.
(Updated February 2021 for PikaJS 1.2)
I had been using jQuery and PrototypeJS, and I needed to ditch PrototypeJS at long last.
My colleague Michael Franzl said, “Hey! Check out this Balalaika thing!”
So I did.
Unfortunately, Balalaika doesn’t give you many methods to do cool stuff. That’s left as an exercise for the programmer…
So, I decided to make my own jQuery, and PikaJS is the result!
Cookie Consent laws: you have surely seen them.
The reason for this is a very stupid law implemented in the European Union that is supposed to protect people from… well, actually, it doesn’t protect anyone from anything. Okay, technically, it protects you from your sanity.
Especially if you use Google Adsense to put ads on your web site, you probably have received an e-mail from them telling you that you must have a Cookie Consent thingie on your site by the end of September 2015 in order to comply with yet another EU cookie law.
Right, so, how do you add cookie consent to your site – quickly and easily?
You have probably encountered embed codes before, but they may seem like a bit of a mystery.
An embed code is, in short, a bit of HTML that allows you to embed part of another web site on your own – like a YouTube video, for example.
Embed codes come in two general flavors these days, and each has its strengths and weaknesses.
So, how do embed codes work? Why are some hugemongous, and others teeny-tiny? Are iframe tags really the spawn of the devil?