Adding class from parent to href in iframe

817 Views Asked by At

I have searched and searched to no avail so I apologise if this has been posted elsewhere already but I couldn't find it. Or I may have found it but not understood enough about the solution to use it for my problem.

I am using http://stratus.sc/ music player on my site. It allows one to click on links to tracks in the body of the site and have them play on the player at the bottom. Looks like this:

Parent Javascript

<script type="text/javascript" src="http://stratus.sc/stratus.js"></script>


<script type="text/javascript">
$(document).ready(function(){
$.stratus({
  links: 'http://soundcloud.com/someartist'
});
});
</script>

iframe HTML:

<a href="http://soundcloud.com/track"  class="stratus">Track Name</a> 

My problem arises because all content on my site is displayed within an iframe so that the player will continue to play as the user navigates. I need the href in the iframe to look for the class "stratus" in the parent window but cannot find the correct syntax to do it. It looks like it should have a fairly simple solution but I am quite a novice at HTML and even more so when it comes to Javascript and jquery.

Thank you in advance.

1

There are 1 best solutions below

7
On

$(".stratus") will select all the elements of class stratus