Posts tagged “web”
I recently revamped my photos page. I wanted an interactive, cross-device gallery to display the photos. In the past, I had been using jbgallery, a slick tool that used jQuery. I was having a bit of a hard time getting it to work the way I wanted and it was a little laggy on iOS and Android devices, so I decided to part ways with it. I don't want to speak poorly of it -- it works very well and the developer is friendly, happy to chat, and works to improve his library constantly. It's a nice tool, but wasn't what I was looking for in the end.
Photoswipe looked rad and performed pretty well on my iOS devices (an iPhone 4 and a 2012 iPad with Retina Display). I decided to give it a whirl.
This is my first tutorial related to this kind of stuff - take it with a grain of salt. And let me know if there are blatant errors or better ways to do things.
Into the body of your webpage, you'll need to put the code pointing to the flickr call. Place this wisely -- it'll play an important role in making all of your photos appear in the proper place. As placement is a bit context specific, we won't go into details here. Play around with it or view the source on photographs if you have initial questions.
Open your favorite text editor and create a new file. Paste the following into it. Create a reference to it in your photo gallery page. We'll go through it in more detail below.
Our first line defines our function. Ce n'est rien.
Our next couple of lines set a newly defined variable -- retina -- to see if the Pixel Ratio > 1.
Our next four lines check that we're getting an okay JSON response from flickr. If it's not okay, things are going to halt. This could be due to a poorly formed request, a lack of API key, etc.
Next, we're going to get the number of responses (photos) pulled from our response. This will be important later. We're also going to define a couple of empty variables that we'll use later.
Now comes a bit of a headache. The comment explains how we're choosing a number of different photo sizes and building URLs to access them. Flickr recently revised its API, so for more information / to keep this thing up to date check out the official documentation.
We basically choose a large square image for the thumbnail for retina displays and a smaller one for non-retina displays; similarly, we choose a large image for retina displays and a smaller one for non-retina displays. This introduces a bit of an issue -- if a user is on Edge with a retina display, the image will load slooooowly. There are ways around this, but its a bit too much for me to deal with.
The next bits -- r+= and s+= -- build list items for each image. This chunk should be filled with code relevant to the layout of your page. If you're not using PhotoSwipe, you can adapt this to whatever you need it to be. Just be sure to keep track of the quotation marks.
If we have a retina display, we embed the retina images; otherwise, we embed the standard images.
And we're off! I made a number of other small tweaks to the PhotoSwipe JS to make it work the way I wanted. But, overall, this covers the gist of it. Download a copy of the script here.
Seems many people are on a redesign tear. All focused on readability and putting content front and center, and abstracting other elements to the background — navigation elements, ads, etc. Zeldman’s the latest — and most extreme — case. His site looks pretty amazing (and striking) and probably looks outstanding on retina-calibre displays (to be confirmed in a few minutes). If we believe the following, we’re blessed:
This redesign is deliberately over the top, but new ideas often exaggerate to make a point. It’s over the top but not unusable nor, in my opinion, unbeautiful. How can passages set in Georgia and headlines in Franklin be anything but beautiful? I love seeing my words this big. It encourages me to write better and more often.
But this is my personal site. There are many like it, but this one is mine. And on this one, I get to try designs that are idea-driven and make statements. On this one, I get to flounder and occasionally flop. If this design turns out to be a hideous mistake, I’ll probably eventually realize that and change it. (It’s going to change eventually, anyway. This is the web. No design is for the ages, not even Douglas Bowman’s great Minima.)
I don’t think you will see much type quite this big but I do think you will see more single-column sites with bigger type coming soon to a desktop and device near you. For a certain kind of content, bigger type and a simpler layout just make sense, regardless of screen size. You don’t even have to use Typekit or its brothers to experiment with big type (awesome as those services are). In today’s monitors and operating systems, yesterday’s classic web fonts—the ones that come with most everyone’s computer—can look pretty danged gorgeous at large sizes. Try tired old Times New Roman. You might be surprised.
The present day designer refuses to die.