One of the things that are most important to me for phase 1 of the state parks app is to have the list of parks be sorted by how far the user is from the park. After all, Tower Hill State Park might be interesting but if you live 4 hours away, you aren’t likely …
Continue reading "How to sort a list of locations by how close they are to you"
Previously, we took a look at my plan to build an app to track state parks. The first step towards phase 1 of the plan is to have some solid data, so we need to build an API. Last year, we looked at building a JSON API using Google Sheets. I don’t see any reason …
Continue reading "State Parks App: The API"
Continue reading "Playing with COVID-19 data: D3.js Bar Charts"
I have been wanting to work with some statistical data for a while now. Recently, I came across The COVID Tracking Project (a project of The Atlantic) and I figured that I would would look at what I could get out of the project’s APIs. The project has a lot of API endpoints but I …
Continue reading "Playing with COVID-19 data"
You don’t necessarily need to write server-side code for everything. Sometime there is a much easier solution. Did you know that you can use Google Sheets as an API endpoint? Let’s take a look at a quick example. For a few years now, I have been archiving my tweets as Google Sheets documents. There is …
Continue reading "Did you know that you can use Google Sheets as a JSON API?"
Ever since Apple bought and shut down Dark Sky, I have been struggling to figure out what to replace it with. I figured that this would be a good excuse to play with some weather APIs. I have done this once before but that was with Rivets and YQL (neither of which I can necessarily …
Continue reading "Playing with the OpenWeather API: The basics"
Previously, we looked at ways to display tabular data on a webpage. Let’s pick up where we left off, but with more data. The last time, the data was hard-coded into an array. This time, let’s use Axios to load some fake data from JSONPlaceholder. See the Pen Table Pagination – Example 1 by Joe …
Continue reading "Playing with more tabular data"
I have used IP Chicken for checking my public IP Address for pretty much 15 years (since hearing about it on TechTV). Once upon a time, I tried writing my own alternative in ColdFusion but it is a lot of overhead for such a dumb thing. I started wondering if I could do it with …
For today’s post, I wrote a pen where the goal was to take the latest photo posted to https://photos.jws.app/ and set it as the background image. In it, I used the blogger API to get a JSON object and I parsed
content for the first href. I then pushed that into a second array and used the first array item as the background, using
See the Pen
Auto-updating Background Image (using Vue.js and Axios) by Joe Steinbring (@steinbring)
I wanted to give the user the ability to change the background, so I output “thumbnails” (they are just the same images with a limited width) of all the images and added
v-on:click to each one so that you can switch. You’ll notice that when the user clicks an image, it changes the value of
current Image to equal
index. Vue watches the value of
currentImage and changes the value of
document.body.style.backgroundImage when it happens.
Vue watchers give you a lot of flexibility because you just need to change that index and vue does the rest. There is no need to add a bunch of functions to an onclick event.
Have a comment or question? Feel free to drop it in the comments, below.
[ Cover photo by Luke Chesser on Unsplash ]