-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaaa.js
47 lines (42 loc) · 1.18 KB
/
aaa.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
var rock_item = $('#rock>.rock-item');
var autoAnimate = setInterval(newFunction, 5000);
function newFunction() {
rock_item.stop(true,true);
rock_item.animate(2000, function () {
if (parseInt(rock_item.css('right')) >= 3320) {
rock_item.animate({
right: '0px'
}, 2000);
}
else {
rock_item.animate({
right: '+=830px'
}, 2000);
}
console.log(parseInt(rock_item.css('right')));
});
}
var rock_thumbnail_item =$('#rock-thumbnail>.rock-thumbnail-item');
rock_thumbnail_item.mouseover(function () {
rock_thumbnail_item.removeClass('active');
$(this).addClass('active');
rock_item.stop(true,false);
moveLoc(rock_thumbnail_item.index(this));
}).mouseleave(function () {
$(this).removeClass('active');
});
$('#rock-thumbnail').mouseover(
function(){
clearInterval(autoAnimate);
}
).mouseleave(
function(){
autoAnimate = setInterval(newFunction, 5000);
}
);
function moveLoc(num) {
var loc = num*830+'px';
rock_item.animate({
right: loc
}, 700);
}