Widget:DragonballWikiNews: Unterschied zwischen den Versionen
Aus DragonballWiki
Weitere Optionen
Inhalt gelöscht Inhalt hinzugefügt
| Zeile 82: | Zeile 82: | ||
// INITIALISATION |
// INITIALISATION |
||
defer(function () { |
defer(function () { |
||
$.getJSON("https:// |
$.getJSON(" https://jojo-news.com/wp-json/wp/v2/posts?per_page=1", function (data) { |
||
initialize(data); |
initialize(data); |
||
}) |
}) |
||
| Zeile 88: | Zeile 88: | ||
console.log("Error! Could not load the JSON file."); |
console.log("Error! Could not load the JSON file."); |
||
}); |
}); |
||
| ⚫ | |||
| ⚫ | |||
function initialize(data) { |
function initialize(data) { |
||
| Zeile 95: | Zeile 94: | ||
$.each(postData, function (key, value) { |
$.each(postData, function (key, value) { |
||
var link = value. |
var link = value.link; |
||
$(".post" + key + "Link").attr('href', link); |
$(".post" + key + "Link").attr('href', link); |
||
var image = $('#post' + key + 'Image'); |
var image = $('#post' + key + 'Image'); |
||
var dataSrc = value. |
var dataSrc = value.uagb_featured_image_src.large[0]; |
||
$(image).attr('data-src', dataSrc); |
$(image).attr('data-src', dataSrc); |
||
var title = value. |
var title = value.title.rendered; |
||
var excerpt = value. |
var excerpt = value.excerpt.rendered; |
||
$("#post" + key + "Title").html(title); |
$("#post" + key + "Title").html(title); |
||
| Zeile 112: | Zeile 111: | ||
} |
} |
||
function createSlider() { |
function createSlider() { |
||
Version vom 1. November 2023, 15:35 Uhr
DragonballWiki News Widget.