Sure, the logic is to call:
Code:
sendEvent('player1','stop')
each time a content is closed, with some way to specify the ID of the player (I presume the code in red above) that's associated with different headers. With that in mind, firstly, inside your containers used as the icon togglers, specify a title attribute pointing to the ID of the video player its sub content is carrying, for example:
Code:
<div class="eg-bar"><span id="faq1-title" title="video1" class="iconspan"><img src="minus.gif" /></span>What is JavaScript?</div>
<div id="faq1" class="icongroup1">
JavaScript is a scripting language originally developed by Netscape to add interactivity and power to web documents. It is purely client side, and runs completely on the client's browser and computer.
</div>
<br />
<div class="eg-bar""><span id="faq2-title" title="video2" class="iconspan"><img src="minus.gif" /></span>Difference between Java & JavaScript?</div>
<div id="faq2" class="icongroup1">
Java is completely different from JavaScript- the former is a compiled language while the later is a scripting language.
</div>
<br />
So closing the first header should also call your custom function to stop the player with ID="video1". To do this, inside statusicon.js, make the changes in red below:
Code:
switchicon.prototype.contractcontent=function(header){
var innercontent=document.getElementById(header.id.replace("-title", "")) //Reference content for this header
innercontent.style.display="none"
header.innerHTML=this.closeHTML
sendEvent(header.title,'stop')
header=null
}
This only works provided that calling something like:
Code:
sendEvent('video1','stop')
will in fact stop the player that's reference-able through the name "video1"
Bookmarks