Merge branch 'gh-pages' of git://github.com/lapilofu/philo into gh-pages
[philo.git] / static / js / init.js
1 var philo_site = {
2         three_up: {
3                 init: function(){
4                         $('.three-up figure').hover(philo_site.three_up.activate, philo_site.three_up.deactivate);
5                 },
6                 activate: function(){
7                         var $this = $(this);
8                         $this.addClass('expanded');
9                         $this.parent().children().not($this).addClass('shrunk');
10                 },
11                 deactivate: function(){
12                         var $this = $(this);
13                         $this.parent().children().removeClass('expanded').removeClass('shrunk');
14                 }
15         },
16         anchor_light: {
17                 init: function () {
18                         var self = philo_site.anchor_light;
19                         links = $('a[href^="#"]');
20                         links.click(self.hiliteHandler);
21                 },
22                 hiliteHandler: function () {
23                         var self = philo_site.anchor_light,
24                                 $this = $(this),
25                                 id = $this.attr('href'),
26                                 el = $(id);
27                         el.addClass("lite");
28                         setTimeout(self.unhiliteHandler, 1000);
29                 },
30                 unhiliteHandler: function () {
31                         $('.lite').removeClass('lite');
32                 }
33         }
34 }
35
36 $(philo_site.three_up.init);
37 $(philo_site.anchor_light.init);