Supporting PDF Embeds in an Eleventy WebC Component / / No Comments Way back in the old days, in August of 2021, I wrote up an example of adding support for Adobe’s PDF Embed API as an Eleventy plugin: "An Adobe PDF Embed Plugin for Eleventy". When I find time, I need to update that to the newest URL for the library, but more recently I was curious if I could recreate support using the WebC template language. While it was a bit difficult at times (and a big thank you goes to Zach for patiently helping me), I think it’s at a point now where it can be shared. I will warn folks that I’m still struggling a bit with the best way to work with WebC, and at least one feature I’m showing isn’t documented yet (but I’ve confirmed... more → Posted in: JavaScript Tagged with: Component, Eleventy, Embeds, Supporting, WebC
The Undeniable Truth on Street View / / No Comments To mark the one year anniversary of Russia’s illegal war on Ukraine the website ‘Undeniable Street View’ has been launched. By providing virtual walks through six Ukrainian cities with custom made 360 degree panoramic ‘Street View’ imagery the Undeniable Street View allows you to see for yourself the damage that Russia has inflicted on Ukrainian infrastructure. The cities of Kyiv, Irpin, Maps Mania… more → Posted in: Interactive Maps Tagged with: Street, Truth, Undeniable, View
Update to My Eleventy Blog Guide / / No Comments Last January, I announced the release of a guide I had written for building a simple blog in Eleventy. Now that Eleventy has hit 2.0, I took some time this morning to look at the guide and see what could be updated. The first thing I noticed was that I had a heck of a lot of typos. I fixed those. I then went through the two main versions of the blog (before and after UI was added) and updated the dependencies to the 2.0 release of Eleventy. That being said, I didn’t do anything else. This is not to say that the 2.0 release wasn’t lacking in new features, but as my guide is meant to be as simple as possible, I wasn’t on the lookout to add any new features if it didn’t make... more → Posted in: JavaScript Tagged with: blog, Eleventy, Guide, update
Document.elementFromPoint / / No Comments Reacting to events with JavaScript is the foundation of a dynamic experiences on the web. Whether it’s a click event or another typical action, responding to that action is important. We started with assigning events to specific elements, then moved to event delegation for efficiency, but did you know you can identify elements by position on the page? Let’s look at document.elementFromPoint and document.elementsFromPoint. The document.elementFromPoint method accepts x and y parameters to identify the top-most element at a point: const element = document.elementFromPoint(100, 100); // If you want to know the entire element stack, you can use document.elementsFromPoint: const... more → Posted in: JavaScript Tagged with: Document.elementFromPoint
Lightship Earth / / No Comments Dutch broadcasting company KRO-NCRV has released an interactive map which visualizes light pollution in the Netherlands. Spaceship Earth allows you to enter any address in the Netherlands to discover how many stars can be seen from that location. The map also explores some of the most (and least) light polluted areas in the country.Spaceship Earth begins with a little scrollytelling tour of the Maps Mania… more → Posted in: Interactive Maps Tagged with: Earth, Lightship
CSS ::file-selector-button / / No Comments We all love beautifully styled form controls but, due to the differences between operating system displays, styling them can be painful. Due to that pain, we’ve created scores of libraries to mock these controls. Unfortunately that sometimes comes at the cost of accessibility, performance, etc. One control that has traditionally been tough to style is the input[type=file] element. Said input variation visually contains a button and text, all being clickable. Bit of a Frankenstein’s monster if you ask me. Can we style the button part though? We can! To style the button button portion of input[type=file], you can use ::file-selector-button: input[type=file]::file-selector-button... more → Posted in: JavaScript Tagged with: fileselectorbutton
Southerners Have Poor Credit & Poor Health / / No Comments Every single person who confuses correlation and causation ends up dying. https://t.co/gPtdUguRYi— Hannah Fry (@FryRsquared) February 13, 2023 I’ve never given a Tweet a standing ovation, but last week I did nearly stand-up and applaud this Hannah Fry’s witty response to a British MP. However, even though correlation does not imply causation, causal analysis can still try to establish Maps Mania… more → Posted in: Interactive Maps Tagged with: credit', health, Poor, Southerners
Detect XR Support with JavaScript / / No Comments A few years ago I wrote an article about how to detect VR support with JavaScript. Since that time, a whole lot has changed. “Augmented reality” became a thing and terminology has moved to “XR”, instead of VR or AR. As such, the API has needed to evolve. The presence of navigator.xr signals that the browser supports the WebXR API and XR devices: const supportsXR = 'xr' in window.navigator; I really like using in for feature checking rather than if(navigator.xr), as simply invoking that could cause some initialization to take place. In future posts we’ll explore identifying and connecting to different devices. The post Detect XR Support with JavaScript appeared... more → Posted in: JavaScript Tagged with: Detect, JavaScript, Support