JSFiddle - React, Tailwind, and code Playground

by jakie8

JavaScript

var iframes = ['http://jakiestfu.com', 'http://jacobkelleydesigns.com', 'http://www.reddit.com'];


function loadFrames(iframes, index) {
    if (typeof index == "undefined") {
        index = 0;
        $('body').append('<div id="frame-loader"></div>');
        $('#frame-loader').css({
            zIndex: '-9999',
            position: 'fixed',
            opacity: 0,
            left: -500
        });
    }
    var id = 'loadFrame-' + index;
    $('#frame-loader').append('<iframe id="' + id + '"></iframe>');
    $('#' + id).attr('src', iframes[index]+'?intent=like');
    index++;
    $('#' + id).load(function() {
        console.log($('#' + id).attr('src') + ' Loaded');
        $('#' + id).remove();
        if (index < iframes.length) {
            loadFrames(iframes, index);
        } else {
            $('#frame-loader').remove();
            console.log('Complete');
        }
    });
}

loadFrames(iframes);