Archive for March, 2008

FeatureSlider [script]

Saturday, March 22nd, 2008

» Instant Gratification Now!

If you’ve ever visited the front page of Beanstalk you’ll know that they have a very nice inline feature tour, which scrolls your across some html content on the front page.

In a project I’ve been working on we need a similar way to browse through a series of articles, so I’ve built a very simple Prototype (and optionally Scriptaculous, if you want the animation to work) script, which makes it trivial to include such tours: feature-slider.js

For the guys at Beanstalk, if you’re reading this: To get your tour to work correctly in Internet Explorer, simply add position:relative to the overall container. I like your temporary IE hack, but still…

Using the code

To use the code, simply do this:

<style>
  #slide {width:300px; height:200px; overflow:hidden;}
</style>
<script src="feature-slider.js"></script>
<div id="slider">
  <div>First item</div>
  <div>(...)</div>
  <div>(...)</div>
  <div>Last item</div>
</div>
<script>var fs = new Slider('slider');</script>

A few real-life examples:

I’ve tried to keep everything simple, which means that the script doesn’t try to build navigation for you. Usually, this is where other similar carousel scripts go wrong. Instead you can use a few functions to browse the items in the FeatureSlider, or you can use callbacks to build advanced navigation:

fs.go(n): Go to a given item in the FeatureSlider
fs.next(n): Go to next item
fs.previous(n): Go to previous item
fs.first(n): Go to first item
fs.last(n): Go to last item

Initiating the code with the events arguments allows you to receive callbacks onLoad and onChange:
var fs = new FeatureSlider($('slider'), {
  onLoad:function(obj){
    alert('Loaded ' + obj.items.length + ' items');
  },
  onChange:function(obj, index){
    alert('Showing ' + index + ' of ' + obj.items.length);
  }
});

Panning/Zooming/Browsing within a photo [script]

Sunday, March 16th, 2008

So I’m doing this great new product for 23 and I’ve built some simple code which allows you to navigate large images in a way quite similar to Google Maps. This is what it looks like (best in non-IE browsers for now):

You can navigate the photo like this…
 Zoom In: Double-click
 Zoom Out: Alt+Double-click
 Navigate: Drag photo

Using the code

The code is basically two simple lines of CSS and some JavaScript enclosed in pan.js — if Prototype and Scriptaculous are loaded. You can even have multiple items on one page.
<style type="text/css">
.viewport {border:1px solid #999; position:relative;
  height:200px; background-color:black; overflow:hidden;}
.viewport-image {position:absolute;}
</style>

<script src="/script/pan.js"></script>

<div class="viewport">
  <img class="viewport-image"
    src="/media/crowd.jpg" onload="new Pan(this);"/>
</div>

Nitty-gritty details: The script requires both Prototype and Scriptaculous, but frankly it could be rewritten for any other animation framework in about five minutes. It only uses the morph method from Scriptaculous, if you want to decrease your footprint slightly, you can substitute the two instances of morph with setStyle from Prototype.

Fire Eagle is in beta

Wednesday, March 5th, 2008

I’ve written about Fire Eagle before and it’s no secret that I had high hopes for the projects. A few hours ago the nice people at Yahoo sent me a beta invite, and greedily read through the developer docs to see what goodies awaited… The result, sadly, is that there aren’t many goodies at the moment.

Most importly, Fire Eagle doesn’t come with any applications yet, so it’s really hard to test the actual UI. I typed in my current location and it registered it. That’s it. Disappointing.

On the API front Fire Eagle doesn’t push too many boundaries either: You can set a user’s location, and you can get the user’s location. As has been reported before, Fire Eagle handles privacy in two ways. First, you need to verify an application’s access level (just as when you use the Flickr or 23 API), and depending on that level of access locations are returned more or less precisely. If, for instance, you only want a Facebook app to know your current city rather than the exact coords, Fire Eagle allows for that. Which is cool. It’s nice that you can upload coords from a GPS tracking thingy and still retain some intimacy.

I won’t make a point-by-point comparison of Fire Eagle to the Plazes API — but they are really similar in scope and ambition. The only difference is that Fire Eagle will see support in fifty apps by April 1st. Plazes won’t. Also, Fire Eagle is not trying to be a social network as well as a backend interface. It’s only the glue between locator apps and location apps.

As I probably mentioned in my previous post I have great hopes for Fire Eagle, but I’m largely underwhelmed by the beta. Hopefully, nice people on the interweb will prove me right in the upcoming weeks?

Update: Nice! While I was bitching about not being able to use Fire Eagle for something useful, Dopplr released support for the Eagle.

Meta3

Monday, March 3rd, 2008

Wow, that’s good. Makes one believe that even IE is susceptible to reason.