-
Notifications
You must be signed in to change notification settings - Fork 484
/
Copy pathcarousel.html
46 lines (33 loc) · 932 Bytes
/
carousel.html
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
<h3>
{{ include.carousel-header-text }}
</h3>
<div id="carousel-id-{{ include.carousel-id }}">
{% for collection_item in include.carousel-collection %}
<div class="{{ include.carousel-id }}-container" id="{{ include.carousel-id }}-slide{{ forloop.index0 }}"
{% if forloop.first %}
style="display: inline;"
{% else %}
style="display: none;"
{% endif %}
>
{{ collection_item.content }}
</div>
{% endfor %}
</div>
<script>
setInterval(function() {
thingies = jQuery(".{{ include.carousel-id }}-container");
if(thingies.length > 1)
{
for(i = 0; i < thingies.length; i++)
{
if($("div#{{ include.carousel-id }}-slide" + i).is(":visible"))
{
$("div#{{ include.carousel-id }}-slide" + i).slideUp("slow");
$("div#{{ include.carousel-id }}-slide" + ((i + 1) % thingies.length)).slideDown("slow");
break;
}
}
}
}, 20000);
</script>