View more demos...

Spotify


Code:

SocialDig({
    selector: '.spotify',
    service: 'spotify',
    user: 'kjbrum',
    auth: 'xxxxx'
}, function(data) {
    if (data.items.length > 0) {
        var list = document.createElement('div');
        list.className = 'g g-s-2 playlists';

        // Loop through the playlists
        data.items.forEach(function(el, idx, arr) {
            if (idx < 4) {
                var item = document.createElement('div');
                item.className = 'gi playlist';

                item.innerHTML = '<iframe src="https://embed.spotify.com/?uri=' + el.uri + '" width="300" height="380" frameborder="0" allowtransparency="true"></iframe>';

                // Add the new item to the list
                list.appendChild(item);
            }
        });

        // Add the list to the page
        document.querySelector('.spotify').appendChild(list);
    }
});

Results: