I am trying to write a function that will dynamically create slides for my slideshow with content pulled from a local Images folder. I've tried a few different scripts from php to ajax and nothing is working out for me. I assume it could be how I am calling the function regarding the Reveal.js framework because I think the code should be working. Any help would be much appreciated! Here is the ajax function I've been fighting with for the last little bit:
var folder = "Images/";
$.ajax({
url: folder,
success: function (data) {
$(data).find("a").attr("href", function (i, val) {
if (val.match(/\.(jpe?g|png|gif)$/)) {
$(".slides").append("<section data-background-image='" + folder + val + "'data-background-size='contain' data-autoslide='5000'></section>");
}
});
}
I'm sure I've just done something stupid here but if anyone has any Reveal.js experience it would be great if you could point me in the right direction!
Aucun commentaire:
Enregistrer un commentaire