Software Engineering in WordPress, PHP, and Backend Development

Tag: JavaScript (Page 3 of 12)

Articles, tips, and resources for JavaScript-based development.

Quick Tip: Check User’s Browser With JavaScript

You’d think in 2018 we’d have a standard way to do browser detection or that the majority of browsers would handle standard idiosyncracies around CSS properly.

But here we are, and it’s still not happening.

This means that when it comes to working with JavaScript, we still may have to do a bit of browser sniffing to determine which browser it is with which we’re working.

Don’t get me wrong: It’s not as bad as it used to be, but there are times in which I’ve recently encountered errors with Chrome and Firefox, specifically.

Continue reading

A Quick Tip for Hiding Browser Extension Overlays

In my experience, most browser extension overlays use a background with the type of data:image/svg+xml. Furthermore, each of these overlays uses inline styles (rather than external stylesheets) to render their buttons (or whatever controls they are opting to render).

Hiding Browser Extension Overlays

This means we can use some JavaScript techniques to find elements with that have these attributes and then toggle their visibility.

But first, why would we care even to hide them?

Continue reading

Creating jQuery Components in WordPress

Front-end development has taken great strides in the last couple of years (and continues to do so) through the use of CSS pre-processors and various JavaScript-based technologies.

The nice thing is that all of these can still be used within the context of WordPress development; however since WordPress includes jQuery, it’s not uncommon to continue writing jQuery-based JavaScript.

Despite all of the various technologies (such as Angular, Vue, React, etc.), I still find myself using jQuery and ES6 more than other libraries and tools.

For simple tasks, it’s not a problem, but when needing to, say, build more advanced components based on the response of an API call, using jQuery can be a bit heavy-handed.

This doesn’t mean it can’t be used – and I’ll walk through how to use it to build components momentarily dynamically – but I think it presents a case as to when other options are more variable.

But more on that at the end of the post.

Continue reading

When Is jQuery’s Clone Function Useful?

One of the challenges of learning a library (be it the standard library of functions that come with a programming language or a third-party project) is two-fold:

  1. learning the functions that are available,
  2. learning how to use said functions.

And, really, sometimes even learning how to use said functions isn’t all that hard – it’s knowing when to use a given function to help minimize code while still achieving the goals of the project.

Continue reading

A Few Gulp Packages for Starters

Software like Gulp and other utilities aren’t new. For those who haven’t used them before, it can be a little daunting to get started (but it really shouldn’t be).

A Few Gulp Packages for Starters

In comparison to tools like CodeKit (which I still like and recommend, depending on the project), they have a little more overhead regarding getting them set up, configured, and ready to go.

But once you’ve got it all set it up, it can be really useful with a distributed team regardless of operating system, and it can help it make your build process a bit more robust.

That’s not the purpose of the post, though. Instead, here’s a list of a few packages for starters.

Think of them this way: If you’re looking for ways to work with Sass, JavaScript, and image optimization, these are good libraries.

Continue reading

« Older posts Newer posts »

© 2024 Tom McFarlin

Theme by Anders NorenUp ↑