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
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
Add a link
Reference in a new issue