Team:Gothenburg/Calendar
From 2014.igem.org
(Difference between revisions)
m |
m (added functionallity) |
||
Line 1,456: | Line 1,456: | ||
/*hide popup*/ | /*hide popup*/ | ||
- | + | jQuery(document).click(function(event) { | |
- | jQuery(document). | + | |
- | + | ||
- | if (!jQuery(event.target).closest('.date').length) { | + | if (!jQuery(event.target).closest('.date').length) { //should have more cases |
box.fadeOut(); | box.fadeOut(); | ||
} | } | ||
- | |||
}); | }); | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | + | /*jQuery( ".date" ).click(function() { | |
+ | showContentOf(this.id); | ||
- | + | });*/ | |
+ | |||
+ | $( ".date" ).click(function(event) { | ||
+ | var currMonth = $(event.target).parentsUntil("#calendar").last().attr('id'); | ||
+ | var _currDate = $(event.target).parentsUntil(".week"); | ||
+ | |||
+ | /*sets currDate to the object of the current date, even if a children is clicked*/ | ||
+ | if(_currDate.length){ | ||
+ | var currDate = $(event.target).parents().eq(_currDate.length - 1); | ||
+ | } else { | ||
+ | var currDate = $(event.target); | ||
+ | } | ||
+ | |||
+ | if ( currDate.hasClass( "prev-month" ) ) { | ||
+ | goToMonth(currMonth, 'prev'); | ||
+ | } else if ( currDate.hasClass( "next-month" ) ) { | ||
+ | goToMonth(currMonth, 'next'); | ||
+ | } else { | ||
+ | showContentOf(this.id); | ||
+ | } | ||
- | |||
}); | }); | ||
Line 1,494: | Line 1,503: | ||
box.fadeIn(); | box.fadeIn(); | ||
+ | } | ||
+ | |||
+ | function goToMonth(currMonth, targetMonth) { | ||
+ | if (targetMonth == 'prev') { | ||
+ | |||
+ | if (currMonth == 'july') { | ||
+ | location.href = "#june"; | ||
+ | } else if (currMonth == 'august') { | ||
+ | location.href = "#july"; | ||
+ | } else if (currMonth == 'september') { | ||
+ | location.href = "#august"; | ||
+ | } | ||
+ | |||
+ | } else { | ||
+ | |||
+ | if (currMonth == 'june') { | ||
+ | location.href = "#july"; | ||
+ | } else if (currMonth == 'july') { | ||
+ | location.href = "#august"; | ||
+ | } else if (currMonth == 'august') { | ||
+ | location.href = "#september"; | ||
+ | } | ||
+ | |||
+ | } | ||
} | } | ||
</script> | </script> |
Revision as of 19:55, 7 August 2014
26
|
27
|
28
|
29
|
30
|
31
|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
13
|
14
|
15
|
16
|
17
|
18
|
19
|
20
|
21
|
22
|
23
|
24
|
25
|
26
|
27
|
28
|
29
|
30
|
1
|
2
|
3
|
4
|
5
|
6
|
30
|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
13
|
14
|
15
|
16
|
17
|
18
|
19
|
20
|
21
|
22
|
23
|
24
|
25
|
26
|
27
|
28
|
29
|
30
|
31
|
1
|
2
|
3
|
28
|
29
|
30
|
31
|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
13
|
14
|
15
|
16
|
17
|
18
|
19
|
20
|
21
|
22
|
23
|
24
|
25
|
26
|
27
|
28
|
29
|
30
|
31
|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
13
|
14
|
15
|
16
|
17
|
18
|
19
|
20
|
21
|
22
|
23
|
24
|
25
|
26
|
27
|
28
|
29
|
30
|
1
|
2
|
3
|
4
|
5
|