Skip to content

Instantly share code, notes, and snippets.

@bryanjswift
Created August 1, 2008 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryanjswift/3632 to your computer and use it in GitHub Desktop.
Save bryanjswift/3632 to your computer and use it in GitHub Desktop.
// not optimized for performance because the Fx.Tween object is continually recreated by calling $('big_picture').get('tween') with new options
$('left').addEvent('click', function(){
if(!$('left').hasClass('deactivated')) {
current_id = $('big_picture').get('class').replace('image_', '');
current_id--;
$('big_picture').get('tween',{
onComplete: function() {
$('big_picture').set('src', 'pictures/' + current_id + '.jpg');
$('big_picture').fade(1);
$('big_picture').set('class', 'image_' + current_id);
if(current_id==1) { $('left').set('class', 'deactivated'); }
if(current_id==(number_of_pictures-1)) { $('right').erase('class'); }
}
});
$('big_picture').fade('hide');
}
});
// not optimized for performance because the Fx.Tween object is continually recreated by calling $('big_picture').get('tween') with new options
$('right').addEvent('click', function(){
if(!$('right').hasClass('deactivated')) {
current_id = $('big_picture').get('class').replace('image_', '');
current_id++;
$('big_picture').get('tween',{
onComplete: function() {
$('big_picture').set('src', 'pictures/' + current_id + '.jpg');
$('big_picture').fade(1);
$('big_picture').set('class', 'image_' + current_id);
if(current_id==2) { $('left').erase('class'); }
if(current_id==number_of_pictures) { $('right').set('class', 'deactivated'); }
}
});
$('big_picture').fade('hide');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment