dimanche 28 juin 2015

Wordpress: Need help to customize .js code to call out specific dynamic class within Visual Composer

Im a novice programmer / designer trying to have fun with some js libraries. With my basic knowledge of code I was able to get 80% there, but Im afraid Im missing the last piece of the puzzle. The site in question is www.topcatsmusic.com

At the bottom ive coded a player which utilizes js. Beneath the player Ive included a dynamic slider to display .jpg files or album covers. As it is now, Ive been using a simple href tag to send to external soundcloud source.

However, the plugin allows you to make API calls to en-queue the song within the player instead of sending to new window, outside source.

Sample API usage:

ToneDen.player.getInstanceByDom("#player").getTrack("http://ift.tt/1NpyKBY");

Custom JS file in use "Clickfunction.js"

  $('.ult-item-wrap a').click(function(e) {
    var sound = $(this).attr('href');
    ToneDen.player.getInstanceByDom("#player").addTracks(sound);
    ToneDen.player.getInstanceByDom("#player").removeTracks(0, 1);
    ToneDen.player.getInstanceByDom("#player").addTracks(sound);
    alert(ToneDen.player.getInstanceByDom("#player").getAllTracks());
    return false;
  });

So, if I load the JS file using the

<script> </script>

within my header - what do I need to do to customize this code so I can identify which song to load based on the custom class assigned to each image?

Aucun commentaire:

Enregistrer un commentaire