-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
58 lines (48 loc) · 1.26 KB
/
index.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
47
48
49
50
51
52
53
54
55
56
57
<html>
<head>
<title>SMS Slideshow</title>
<style>
#slides {
height: 100%;
width: 100%;
margin:0;
background-color: #4D4E53;
}
img {
height: 100%;
width: auto;
display:none;
}
</style>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
<div id="slides">
<img src="http://cdn.wonderfulengineering.com/wp-content/uploads/2014/07/background-wallpapers-32.jpg">
<img src="http://cdn.wonderfulengineering.com/wp-content/uploads/2014/07/background-wallpapers-26.jpg">
</div>
<script src="https://cdn.socket.io/socket.io-1.2.0.js"></script>
<script>
var socket = io();
socket.on('picture', function (data) {
var img = $('<img>');
img.attr('src', data);
img.appendTo('#slides');
console.log(data);
});
$(function() {
var images = $('#slides img').length;
var currentImage = 0;
function changeSlide () {
images = $('#slides img').length;
currentImage++;
if (currentImage > images) {
currentImage = 1;
}
$( "#slides img:nth-child(" + currentImage+ ")" ).fadeIn("fast").delay(6000).fadeOut('fast');
}
setInterval(changeSlide, 6000);
});
</script>
</body>
</html>