Tagged: LayerSlider WP
-
AuthorPosts
-
May 28, 2020 at 4:01 pm #1217402
Hello
How can I pause an audio playing at slide change (layerslider wp) ?
I tried with event callbacks in “slideCHangeDidStart” tab :function( event, slider ) { $('#layer_slider_1').layerSlider('resetSlide'); or $('#layer_slider_1').layerSlider('pauseMedia'); }
Nothing works, I have few experience in this…
Any tips ?
Thanks
- This topic was modified 4 years, 5 months ago by romano2.
June 4, 2020 at 12:03 pm #1219345Hey romano2,
Thank you for the inquiry.
How did you add the media file, and where did you get the above snippet from? Please provide a link to the page containing the layer slider so that we can check it.
The following documentations might help.
// https://layerslider.kreaturamedia.com/documentation/#layerslider-api
// https://www.iolo.com/content/plugins/LayerSlider/docs/api.htmlBest regards,
IsmaelJune 4, 2020 at 3:31 pm #1219430Thanx for answer Ismael,
I added my audio with a HTML layer, with a simple shortcode in the content, like :
[audio mp3="http://graphikarbre.xyz/voulgre/wp-content/uploads/2020/05/lecivet.mp3"][/audio]
I found the above snippet from layerslider help :
Thanks for your tips.
RomanoJune 8, 2020 at 7:42 am #1220370Hi,
Thank you for the info.
You can try this script inside the Media Events > mediaDidStart() callback.
var audio = document.getElementsByClassName("wp-audio-shortcode"); for (var i = 0; i < audio.length; i++) { audio.item(i).pause(); audio.item(i).currentTime = 0; }
It will pause the audio immediately before it actually starts.
Best regards,
IsmaelJune 8, 2020 at 12:50 pm #1220448Ok, many thanks, you show me the way.
I succeeded with this code :function( event, slider ) { var audioz = document.getElementsByTagName("audio"); for (var i = 0; i < audioz.length; i++) { audioz.item(i).pause(); audioz.item(i).currentTime = 0 } }
I put it in : SLIDE CHANGE EVENTS > slideChangeWillStart
With .getElementsByClassName there was too much non-audio object wich cause errors.
Thanks again.June 8, 2020 at 3:16 pm #1220491Hi,
I’m glad you found a solution. Should we close this topic?
Best regards,
Jordan ShannonJune 8, 2020 at 3:25 pm #1220498Yes you can close it, thanks.
June 8, 2020 at 3:55 pm #1220507Hi,
If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon -
AuthorPosts
- The topic ‘Layerslider wp – Stop media at slide change’ is closed to new replies.