/
app.js
151 lines (116 loc) · 3.33 KB
/
app.js
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
jQuery(document).ready(function()
{
var currentImage = "";
var interfaceLock = false;
jQuery("#roundrr_container").roundrrwheel(
{
mode: 'standard', //mode can be pick or standard
autoplay: false,
autoplayDirection: 'anticlockwise',
autoplayDuration: 4000,
centerClass: 'roundrr_center',
listClass: 'list',
itemClass: 'item',
radius: 220,
animSpeed:400,
centerX: 29,
centerY: 60,
animationEffect: 1, //(1:off, 5:light,10:heavy, 15:subtle)
selectEvent: "click",
centerImageSrc: "../../images/placeholder2.png",
//on selecting/clicking an item on the wheel
onSelect: function($selected)
{
showLargeImage($selected, 'noanim');
},
//on beginning to spin/animate the wheel
onNextBegin: function($m)
{
//interfaceLock = true;
},
onPrevBegin: function($m)
{
//interfaceLock = true;
},
//once an image has moved under the 'pick'
onImageFocus: function($item)
{
showLargeImage($item, 'none');
},
//once an image/image set is no longer under the 'pick'
onImageBlur: function($item)
{
},
//once the animation has completed
onAnimationComplete: function($menu)
{
jQuery('.centerImage').attr('src', currentImage);
jQuery('.centerImage').load(function()
{
interfaceLock = false;
});
},
angleOffset: Math.PI,
onShow: function($menuitems)
{
$menuitems.each(function(i)
{
var $this = jQuery(this);
$this.delay(i*100).fadeIn(500);
});
}
});
jQuery("#roundrr_container").roundrrwheel("show");
$('#next').bind('click', spinMenuRight);
$('#prev').bind('click', spinMenuLeft);
function showLargeImage($i, mode)
{
interfaceLock = true;
var thisImage = $i.find('img');
var focusedImage = thisImage.attr('src');
var largerImage = focusedImage.replace('_bigger', '');
var imageCaption = thisImage.attr('alt');
var speechBubble = jQuery('.roundrr_speech');
speechBubble.fadeIn();
currentImage = largerImage;
jQuery('#roundrr_caption').fadeIn();
jQuery('#roundrr_caption').html(imageCaption);
if(mode=='noanim')
{
jQuery('.centerImage').attr('src', currentImage);
jQuery('.centerImage').load(function()
{
interfaceLock = false;
});
}
}
/*Spin the menu to the left*/
function spinMenuLeft()
{
if(!(interfaceLock))
{
jQuery("#roundrr_container").roundrrwheel("prev");
}
}
/*Spin the menu to the right*/
function spinMenuRight()
{
if(!(interfaceLock))
{
jQuery("#roundrr_container").roundrrwheel("next");
}
}
/*Keydown events*/
$(window).keydown(function(event)
{
var keycode = event.keyCode;
switch(keycode)
{
case 39:
spinMenuLeft();
break;
case 37:
spinMenuRight();
break;
} });
});