-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
57 lines (56 loc) · 1.34 KB
/
script.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
"use strict";
var animationTime = 600;
$(".rightArrow").click(function () {
$(".arrows").children().prop('disabled', true);
$(".slider").each(function () {
var lastImg = $(this).children().last();
var newImg = lastImg.clone();
var w = lastImg.css("width");
newImg.css({
"width": "0",
"margin-left": "0",
"opacity": "0"
});
newImg.prependTo($(this));
newImg.animate({
opacity: 1,
marginLeft: '10px',
width: w
}, animationTime);
lastImg.animate({
opacity: 0,
width: 0,
margin: 0
}, animationTime, function () {
lastImg.remove();
$(".arrows").children().prop('disabled', false);
});
});
});
$(".leftArrow").click(function () {
$(".arrows").children().prop('disabled', true);
$(".slider").each(function () {
var firstImg = $(this).children().first();
var newImg = firstImg.clone();
var w = firstImg.css("width");
newImg.css({
"width": "0",
"margin-left": "0",
"opacity": "0"
});
newImg.appendTo($(this));
newImg.animate({
opacity: 1,
marginLeft: '10px',
width: w
}, animationTime);
firstImg.animate({
opacity: 0,
width: 0,
margin: 0
}, animationTime, function () {
firstImg.remove();
$(".arrows").children().prop('disabled', false);
});
});
});