ui: rajouter jquery et slider, comment out carousel
This commit is contained in:
parent
52dd5693fb
commit
5a21a5154b
2 changed files with 48 additions and 1 deletions
|
@ -2,8 +2,10 @@
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<title>AGECEM | babillard</title>
|
<title>AGECEM | babillard</title>
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
|
||||||
<link rel="stylesheet" href="/public/css/style.css">
|
<link rel="stylesheet" href="/public/css/style.css">
|
||||||
<script src="/public/js/carousel.js"></script>
|
<!--<script src="/public/js/carousel.js"></script>--!>
|
||||||
|
<script src="/public/js/slider.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
45
ui/js/slider.js
Normal file
45
ui/js/slider.js
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
var images = [];
|
||||||
|
var indexImages = 0;
|
||||||
|
|
||||||
|
function afficherIndex() {
|
||||||
|
$('#debug').text(indexImages);
|
||||||
|
}
|
||||||
|
|
||||||
|
function afficherImage() {
|
||||||
|
$('#image').attr('src', "/api/contenu/"+images[indexImages]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function augmenterIndex() {
|
||||||
|
if (indexImages >= images.length - 1) {
|
||||||
|
indexImages = 0;
|
||||||
|
} else {
|
||||||
|
indexImages ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function executionLoop(){
|
||||||
|
//afficherIndex();
|
||||||
|
afficherImage();
|
||||||
|
augmenterIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
function obtenirContenu(){
|
||||||
|
var response = '';
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: window.location.origin + "/api/contenu",
|
||||||
|
async: false,
|
||||||
|
success: function(text) {
|
||||||
|
response = text;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(response);
|
||||||
|
images = response.split(';');
|
||||||
|
console.log(images);
|
||||||
|
}
|
||||||
|
|
||||||
|
$(function(){
|
||||||
|
obtenirContenu();
|
||||||
|
var executionInterval = setInterval(executionLoop, (Math.floor(Math.random() * 6)+15)*1000);
|
||||||
|
});
|
Loading…
Add table
Reference in a new issue