<script>
const playSvg = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"\
height="100" width="100" viewBox="0 0 100 100">\
<polygon fill="white" points="20,20 80,50 20,80"/>\
</svg>';
const pauseSvg = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"\
height="100" width="100" viewBox="0 0 100 100">\
<line stroke-width="10" stroke="white" x1="40" y1="20" x2="40" y2="80" />\
<line stroke-width="10" stroke="white" x1="60" y1="20" x2="60" y2="80" />\
</svg>';
$z(document).ready(() => {
// Slider bereit stellen
const slider = $z('.zp13slider-container');
// Play-/Pause-Button erzeugen
const playPauseBtn = $z('<button></button>');
playPauseBtn.css({
width: '40px', height: '40px',
backgroundSize: '100% 100%',
backgroundImage: 'url(\'data:image/svg+xml;utf8,' + pauseSvg + '\')',
backgroundColor: 'transparent',
position: 'absolute', zIndex: '10',
left: 'calc(50% - 20px)', top: '0',
border: 'none', outline: 'none'
})
// Beim Klick wird der Slider pausiert oder fortgesetzt
playPauseBtn.on('click', () => {
if (playPauseBtn.hasClass('paused')) {
slider.flexslider("play") // Continue slideshow
playPauseBtn.css({ backgroundImage: 'url(\'data:image/svg+xml;utf8,' + pauseSvg + '\')' });
} else {
slider.flexslider("pause") // Pause slideshow
playPauseBtn.css({ backgroundImage: 'url(\'data:image/svg+xml;utf8,' + playSvg + '\')' });
}
playPauseBtn.toggleClass('paused');
});
// Play-/Pause-Button zum Container des Slidders hinzu fuegen
slider.append($z(playPauseBtn));
});
</script>