Tag: javascript

  • How to really check with JavaScript if CSS failed to load from a CDN

    How to really check with JavaScript if CSS failed to load from a CDN

    I want to load a third-party CSS stylesheet from a CDN, but I’m concerned how it will affect my site if the CDN goes down. How do I use JavaScript to check if a CSS file has loaded so I can load a local fallback instead? This can’t be a new idea. I can get […]

  • Should We Avoid Ternary Operators?

    Should We Avoid Ternary Operators?

    I recently read a Facebook post which suggested it was better to use a ternary operator instead of an if…else statement whenever the result would be a single line of code. That doesn’t seem right. I’ve noticed this trend toward shorter, smaller code, and I understand the appeal. If I can do in one line […]

  • transitionend Promise

    transitionend Promise

    I’m working on a page that displays thumbnail images. When I click on a thumbnail I want it to show an info box containing more image details. I’m using a CSS transition on the info box and I want to populate the image details while the info box is hidden. If the info box is […]