I'm trying to use a function that switches an iframe's source link on Github Pages. It is from here.
The iframe sources are p5.js sketches also hosted on Github Pages. The whole page (121templatetwo) works locally but when pushed to Github Pages, the iframe is empty.
Link to 121templatetwo repo: https://github.com/lilykdonaldson/121templatetwo
Code for iframe switcher (which is also in the repo):
var switcher$ = $('.switcher'), // select element
switchTarget$ = $('.switch-target'); // iframe
switcher$.on('change', switchIframeSrc); // event binding
// our functiono to switch the iframe src
function switchIframeSrc() {
// set the 'src' attribute of the iframe
// to the value of the selected option
switchTarget$.attr('src', switcher$.val());
}
// call the method on load
switchIframeSrc();
And the link to the Github Page where the iframe is empty.