-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathiframe-carousel-r1.html
116 lines (76 loc) · 2.83 KB
/
iframe-carousel-r1.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<!doctype html>
<html lang = "en" >
<head>
<meta charset = "utf-8" >
<meta name = "viewport" content= "width=device-width, initial-scale=1">
<meta name = "description" content = "slide show" >
<meta name = "keywords" content = "JavaScript,GitHub,FOSS,3D,STEM" >
<meta name = "date" content = "2017-10-11" >
<title></title>
<style>
body { font: 12pt monospace; margin: 0 auto; max-width: 800px; }
a { color: crimson; text-decoration: none; }
a:hover, a:focus { background-color: yellow; color: #aaa; text-decoration: underline }
iframe { border: none; margin: 0; }
iframe {
display: block;
border: 0;
-moz-transition: all 1.9s;
-webkit-transition: all 1.9s;
-ms-transition: all 1.9s;
-o-transition: all 1.9s;
transition: all 1.9s;
opacity: 1;
}
iframe.fade-out {
opacity: 0;
iframe.fade-in {
opacity: 1;
}
</style>
</head>
<body>
<div id = "header" >
<div id = "title" ></div>
<div id = "contents" >
</div>
</div>
<iframe id=ifr width=100% height=480px ></iframe>
<script>
const sites = [
{ fileName: 'https://webmath.github.io/cookbook/chart-nurbs/index.html',
title: 'chart nurb' },
{ fileName: 'https://rawgit.com/webmath/cookbook/master/chart-scatter-3d/index.html',
title: 'chart scatter 3d' },
{ fileName: 'https://rawgit.com/webmath/cookbook/master/rubiks-cube/rubiks-cube-r3-theo.html', title: 'rubiks' }
];
let index = Math.floor( Math.random() * sites.length );
let timer;
let ifr = document.getElementById( 'ifr' ); // for Safari compatibility
init();
function init() {
let txt;
// title.innerHTML = '<h2><a href = "" >' + location.href.split( '/' ).pop().slice( 0, -5 ).replace( /-/g, ' ' ) + '</a></h2>';
txt = 'lorem ipsum, quia dolor sit, amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt, ut labore et dolore magnam aliquam quaerat voluptatem. ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? quis autem vel eum iure reprehenderit, qui in ea voluptate velit esse, quam nihil molestiae consequatur, vel illum, qui dolorem eum fugiat, quo voluptas nulla pariatur?';
// contents.innerHTML = txt;
clearInterval( timer );
displayNext();
timer = setInterval( displayNext, 8000 );
// iOS iframe auto-resize workaround
if ( /(iPad|iPhone|iPod)/g.test( navigator.userAgent ) ) {
ifr.style.width = getComputedStyle( ifr ).width;
ifr.style.height = getComputedStyle( ifr ).height;
ifr.setAttribute( 'scrolling', 'no' );
}
}
function displayNext() {
index = index >= sites.length ? 0 : index;
if ( ! sites[ index ].fileName ) { return; }
ifr.onload = function() { ifr.className = 'fade-in'; }
setTimeout( function(){ ifr.className = 'fade-out'; }, 6000);
ifr.src = sites[ index ].fileName;
index++;
}
</script>
</body>
</html>