0

I could really use some help on this one. I need to add a class to the body tag when someone presses the play button on a Vimeo embed.

The background on the site is white and when someone presses the play button, a class is added to the body tag so the background fades to black (body class="bgcolor_black"). And when the movie is paused or stops it goes back to the white background (body class="bgcolor_white").

Is this possible? The site is built on Wordpress. I have searched alot but all I can find is about a extra button to "turn the lights off".

Thanks in advance and sorry if the english is bad :)

swedoc
  • 15
  • 3
  • Not sure if this helps and by no way this is an answer to your question, but, just a guidance. http://stackoverflow.com/questions/1789233/track-a-click-on-a-flash-movie-object-embed-with-jquery – lshettyl Feb 14 '14 at 12:23

2 Answers2

1

This cannot be done unless vimeo.com allows your domain to execute cross-domain interaction. It is not allowed for security reasons. This security measure is known as the Same Origin Policy.

Sionnach733
  • 4,686
  • 4
  • 36
  • 51
  • Thanks for getting back to me and thanks Sionnach for this suggestion, it is exactly what im looking for. Unfortunately I didnt get it to work. Theres no action when im pressing the play button on the vimeo movie. I tried to put the code both in the footer.php and the header.php, i also tried putting the "bgcolor_white" as a static class in the body tag (so it had something to remove). Do you have any idea? I saw somewhere else that I should add "listeners" first. Can that be the problem here? That the script works but cant find the ".play-icon" – swedoc Feb 15 '14 at 21:35
  • @swedoc my mistake, after doing some more research, I found that it is not possible, see updated answer. – Sionnach733 Feb 16 '14 at 16:49
  • Ouch! Ok thanks, we have a pro account on Vimeo so maybe they have that option. I update this if I get a answer from Vimeo on the matter. Have a great week! – swedoc Feb 17 '14 at 08:13
  • did the pro account grant you access? Consider accepting this answer. – Sionnach733 Feb 19 '14 at 09:58
  • Yes, I seems that it's possible with the Vimeo API. I couldn't do an follow up, cause the client said no to the feature :/ Thanks for the help! – swedoc Feb 20 '14 at 13:08
0

Try this with jQuery!

http://api.jquery.com/addclass/

If you have trouble with implementing comment this answer!

Karol May
  • 181
  • 2
  • 16