Category: JavaScript
Conquering scrollbars
So suppose you want to fix the sidebar on a Twenty Fifteen WordPress site, because most of the time it’s going to be short enough to fit entirely on the screen. And suppose you don’t want the nice wide scrollbar Internet Explorer (even 11) will put down the edge of your sidebar whether or not scrolling is happening or even possible. Let’s talk about that.
Accordion Widgets for Twenty Fifteen
Gilding the Gallery 3: Ajaxifying the filterable gallery
Last time we set up the PHP (slash HTML, slash CSS) to dynamically generate Media Library Assistant gallery shortcodes and an album menu. Everything works without any JavaScript. Today we’re going to add JavaScript, with jQuery, to do three things.
- Hide the album menu under a button, a la a mobile menu.
- Use AJAX to reload only the portion of the page containing the gallery.
- Push each new URL into the browser history, so that the back button works and individual albums can be bookmarked.
Gilding the Gallery: MLA + Flickity
Applying the JavaScript carousel program Flickity to a WordPress gallery, or more properly a Media Library Assistant gallery, for responsiveness and easy updating.
JavaScript nodelist hazards
If you grab a bunch of elements from your webpage with document.getElementsByClassName though the console may tell you the elements inhabit an array, they are actually in a NodeList. You can interact with a NodeList very similarly to an array, but unlike an array a NodeList is live-updated. This difference will probably only matter if […]