Я получаю JSON, который содержит информацию, связанную с игрой, и создает div с помощью JS, например:
Код: Выделить всё
fetch("thething.json")
.then(res => res.json())
.then(data =>{
games = data.map(game => {
const newDiv = document.createElement("div");
newDiv.className = "game-info";
newDiv.innerHTML = `
${game.Name}
[img]${game.Thumbnail}[/img]
${game.Description}
`;
document.body.appendChild(newDiv);
Код: Выделить всё
[{"Name: gamename1,
"Thumbnail: https://imglocation,
"Description": This game is indeed a game
},
{"Name: gamename2,
"Thumbnail: https://imglocation2,
"Description": This game2 is indeed a game2
}
]
Код: Выделить всё
function toggler(){
$('div.game-info').click(function(e){
$(this).children('.info').toggle();
});
}
Подробнее здесь: https://stackoverflow.com/questions/781 ... -hide-show
Мобильная версия