blob: b3b6ef8aa580564e0f4b693bc5ab75f09211a9d7 (
plain)
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
|
$(document).ready(function() {
var pos = 'out';
var bak = [ '#d7eab0','#27ae60','#34495e'];
var random = Math.floor(Math.random()*1);
var $cur = $('.nice-text').eq(random);
$('.nice-text').hide();
$cur.show();
$('.nice-bar').css('background', bak[random]);
$(".nice-bar").slideDown(function() {
var i = random;
setInterval(function() {
if(pos == 'out') {
i = (i == 1) ? 0 : ++i; // [0, 1, 2] since 3 events
$('.nice-text').hide();
$cur = $('.nice-text').eq(i);
$('.nice-bar').css('background', bak[i]);
$cur.show();
}
}, 3500);
});
$('.nice-bar').mouseenter(function() {
pos = 'in';
console.log(pos);
}).mouseleave(function() {
pos = 'out';
console.log(pos);
});
$(".nice-close").click(function() {
$(".nice-bar").slideUp();
});
});
|