Sunday, 11 August 2013

need single click event in multiple playlists

need single click event in multiple playlists

i am using fancy music player in my website and i have multiple playlists
in the format below
<div class="playlist">
<a href="mysong.mp3" class="fmp-my-track add_link">add this song</a>
<a href="mysong.mp3" class="fmp-my-track add_link">add this song</a>
<a href="mysong.mp3" class="fmp-my-track add_link">add this song</a>
</div>
<div class="playlist">
<a href="mysong.mp3" class="fmp-my-track add_link">add this song</a>
<a href="mysong.mp3" class="fmp-my-track add_link">add this song</a>
<a href="mysong.mp3" class="fmp-my-track add_link">add this song</a>
</div>
<div class="playlist">
<a href="mysong.mp3" class="fmp-my-track add_link">add this song</a>
<a href="mysong.mp3" class="fmp-my-track add_link">add this song</a>
<a href="mysong.mp3" class="fmp-my-track add_link">add this song</a>
</div>
i want when user click first time on any link in one playlist then it
clears the playlist and on next clicks it adds the songs in playlist for
example when user click any link from first playlist it clears the
playlist and add the song in playlist and on next clicks within this
playlist it will not clear the playlist. when user click on any link from
other playlist same here first time it will clear the playlist and then it
will add the songs..i am using the code below to achieve this but it does
not work
$(".playlist").each(function(){
$(".add_link").one("click", function(){
$.fancyMusicPlayer.clear();
});
$(".add_link").click(function(){
$.fancyMusicPlayer.addTrack(this.href, this.title,
this.target,false);
});
});
adding the song in playlist is working fine but the functionality of
clearing the playlist on first click is not working.if any one can help
me.
Thanks in advance!!

No comments:

Post a Comment