ui: rajouter jquery et slider, comment out carousel #26

Merged
vlbeaudoin merged 2 commits from vlbeaudoin/feature/api-v2-et-cleanups into main 2025-02-12 17:42:07 -05:00 AGit
2 changed files with 48 additions and 1 deletions
Showing only changes of commit 5a21a5154b - Show all commits

View file

@ -2,8 +2,10 @@
<head>
<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">
<script src="/public/js/carousel.js"></script>
<!--<script src="/public/js/carousel.js"></script>--!>
<script src="/public/js/slider.js"></script>
</head>
<body>

45
ui/js/slider.js Normal file
View 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);
});