I use a fantastic 3rd party plugin for playing music and Youtube videos.
The site I have started creating is using a Slider - for which I am using the code in the footer for custom code
$(document).ready(function() {
$('#heroslide1').click(function(e) {
e.preventDefault()
$('.hero-link').removeClass('active');
$(this).addClass('active');
$('.w-slider-nav div:nth-child(1)').trigger('tap');
});
$('#heroslide2').click(function(e) {
e.preventDefault();
$('.hero-link').removeClass('active');
$(this).addClass('active');
$('.w-slider-nav div:nth-child(2)').trigger('tap');
});
$('#heroslide3').click(function(e) {
e.preventDefault();
$('.hero-link').removeClass('active');
$(this).addClass('active');
$('.w-slider-nav div:nth-child(3)').trigger('tap');
});
$('#heroslide4').click(function(e) {
e.preventDefault();
$('.hero-link').removeClass('active');
$(this).addClass('active');
$('.w-slider-nav div:nth-child(4)').trigger('tap');
});
$('#heroslide5').click(function(e) {
e.preventDefault();
$('.hero-link').removeClass('active');
$(this).addClass('active');
$('.w-slider-nav div:nth-child(5)').trigger('tap');
});
$('#heroslide6').click(function(e) {
e.preventDefault();
$('.hero-link').removeClass('active');
$(this).addClass('active');
$('.w-slider-nav div:nth-child(6)').trigger('tap');
});
});
I can use API for the audio / video player to stop these playing when a button is clicked
window.onload = function() {
var anchors = document.getElementsByTagName('*');
for(var i = 0; i < anchors.length; i++) {
var anchor = anchors[i];
anchor.onclick = function() {
code = this.getAttribute('whenClicked');
eval(code);
}
}
}
Called using custom attributes on a button:
<a whenClicked=“window[“player1”].loadPlaylist(0)”
However I can only do one or the other - so I can either stop the music OR switch slides not both.
My JS knowledge is limited and I have tried combining the two codes but nothing works.
Any help appreciated.