Я совершенно новый с операторами и т. Д. Я просто не знаю, с чего начинать с этого. Изображения и слова загружаются из файла JSON, и у меня уже есть первый бит кодов. Автоматически. < /p>
Я думаю, это звучит сложно. Я надеюсь, что кто -то сможет мне помочь. < /P>
json: < /p>
Код: Выделить всё
{"main_object": {
"imagesJ": ["beak", "cat", "egg", "meel", "milk", "passport", "spoon", "thee"],
"wordsJ": ["næb", "kat", "æg", "mel", "mælk", "pas", "ske", "te"]
}
}
< /code>
var jsonData = "noJson";
var hr = new XMLHttpRequest();
$(document).ready(function(){
var jsonData = 'empty';
$.ajax({
async: false,
url: "./js/data.json",
dataType: 'html',
success: function(response){
jsonData = JSON.parse(response);
console.log('ok');
var imagesJ = jsonData.main_object.imagesJ;
var wordsJ = jsonData.main_object.wordsJ;
var html = '';
var html2 = '';
for(i = 0; i < imagesJ.length; i++) {
//html += '';
//if statement that when there are 0-3 = 4 pictures it begins a new block of code which makes 0-3 = 4 pictures, that are in bootstrap row PROBEER DIT ALLEEN MET STACKOVERFLOW OF ANDERE INTERNET DINGEN
html += '
[img]/sleepopdracht/img/[/img]
';
}
html += '';
document.getElementById('images').innerHTML = html;
for (i = 0; i < wordsJ.length; i++) {
html2 += ''+wordsJ[i]+'
';
}
document.getElementById('words').innerHTML = html2;
},
error: function(){
console.log('JSON could not be loaded.');
}
});
console.log(jsonData);
});< /code>
header {
position: relative;
height: 20%;
/*border-bottom: thick solid grey;*/
}
body {
background-color: #f0f0f0;
}
.container {
position: relative;
height: 50%;
}
.images img {
position: relative;
height: 100px;
width: 100px;
}
#img4, #img5, #img6, #img7 {
top: 5%;
}
footer {
position: relative;
height: 5%;
/*border-top: thick solid grey;*/
}< /code>
Sleepopdracht
[img]/sleepopdracht/img/[/img]
a
a
a
a
a
a
a
Как вы можете видеть в html, я сделал эти ряды, им нужно стать одним из них и немного похож на
Подробнее здесь: https://stackoverflow.com/questions/363 ... -a-new-row
Мобильная версия