Username:

Password:

Author Topic: Nettuts+: Recreating the MobileMe Web Gallery Interface: Part 2  (Read 201 times)

siteFEEDS

  • Administrator
  • Hero Member
  • *****
  • Karma: +1/-0
  • Posts: 1994
Recreating the MobileMe Web Gallery Interface: Part 2
5 July 2009, 10:28 pm

Last week, I showed you how to recreate Apple’s MobileMe Gallery interface.  Today, we will refine the interface with more features, including a larger view for the grid view, as well as a slideshow with crossfade transitions.





Preface

Last week, we ended up with a gallery that had two different views for our photos: Grid View and Mosaic View.  What it was missing, however, as many of you pointed out, was a larger view or lightbox for the grid view.  This way, when you clicked on an image in the grid view, a larger image would appear so that you could see it better.  We will add that in this week’s tutorial.



Another nice feature to have would be a slideshow view.  Sometimes it is nice to just sit back and enjoy the pictures rather than having to click around.  Apple’s slideshow view is fairly rudimentary, with no transitions at all (the images jump from one to the next), which is very un Apple-like!  We will work on that as well.



Step 1: Read Last Week’s Tutorial!



This is a very important step, even though it is obvious.  In order for you to understand this tutorial, you will need to have read last week’s. You will also need to download the source code from last week’s tutorial, because we will use it as a starting point.

Step 2: Add the Needed Files



We will need two images for this tutorial. One of them is used in the large image view, and the other in the slideshow view. You should download this zip file and place the two images that are extracted into a folder called images within the assets folder from last week’s tutorial.

We will also need three files for our slideshow view: an html file, a css file, and a JavaScript file.  First, create a file called slideshow.html in the root of last weeks tutorial folder that you downloaded.  Next, create slideshow.css inside assets/css, and finally create slideshow.js in assets/js.  You should now have all of the necessary files!

Step 3: The Larger View

We will start by creating the large image view for the grid view.  First, open javascript.js (in the assets/js folder) with a text editor, and un-comment the two lines that look like this: largeView(this, i) (lines 105, and 138).  These lines will call our largeView function, and tell it the current image so that we can display the correct one at full size.  But, before this will work, we need to create the largeView function.

function largeView(photo, i) {

current = i;

var item = data;

var hovered = false;

$("h1").hide();

$(".button").remove();

$("#controls").hide();

$("#content").css({ bottom: "0px", top: "0px" });

$("#content").attr("class", "").addClass("large_view");

$("#content *").remove();

$('
Back to Album
').click(function() {

view(); //go back to the current view

}).appendTo("#content");

var large = $('
');

$("").attr("src", item.src).appendTo(large);

$("").html(item.title).appendTo(large);

large.appendTo("#content");

var wrapper = $('
');

var hover = $('
').hover(function() {

hovered = true;

}, function() {

hovered = false;

});

$('