How to Make Spotify Responsive with Fitvid.js

After trying to make Slideshare presentations responsive with Fitvid.js I tried it with spotify. This is something that I had attempted months before, but to no avail. There are a couple of jQuery CSS solutions out there, but none of those really worked all that well either.

Alas, I attempted it again following the same method at Slideshare as seen in this post.

I will repeat the steps here while substituting the Slideshare code with Spotify’s…

Note: Leave in the sizing parameters. No idea why, but this makes the album art show in a more aesthetic way.

Make Spotify Responsive

To make Spotify posts responsive the first thing you need to do is obtain the Spotify embed code available when you right click on a song in the desktop app. Paste it where you would like to have your video, and proceed to open up your Fitvid.js file and locate the following code.

var selectors = [
        "iframe[src*='player.vimeo.com']",
        "iframe[src*='youtube.com']",
        "iframe[src*='youtube-nocookie.com']",
        "iframe[src*='kickstarter.com'][src*='video.html']",
        "object",
        "embed"
      ];

Now you will want to add the following snippet right under the Kickstarter selector (or the Slideshare one if you added that too!)


"iframe[src*='slideshare.net']",

Make sure you include “embed” before the url. After you have added that snippet you should have the following code.


return this.each(function(){
      var selectors = [
        "iframe[src*='player.vimeo.com']",
        "iframe[src*='youtube.com']",
        "iframe[src*='youtube-nocookie.com']",
        "iframe[src*='kickstarter.com'][src*='video.html']",
        "iframe[src*='slideshare.net']",
        "iframe[src*='embed.spotify.com']",
        "object",
        "embed"
      ];

Save the file, make sure you’ve correctly targeted the area you would like to resize the videos in, and you should be all set.

If you would like you can also specify a new selector right in your jQuery code without altering the fitvid file by inserting the following code!

$("#thing-with-videos").fitVids({ customSelector: "iframe[src^='embed.spotify.com']"}); 

Let me know if you’re having any trouble int he comment section to the right!


Subscribe for More!


I send out a monthly newsletter on various topics.

Take a moment to enter your details, and you can select the news you would like to have delivered to your inbox!