Agamemno Posted November 26 Posted November 26 Site URL: https://www.smegmaxrpl.com Is there any code I can use that would allow me to play audio as I hover the curser over images? I also want to make sure that the audio doesn't bleed & overlap if quickly moving through images. This may not be much of an issue as the soundbite is a short digital beep. If it's easier to disregard the overlap issue, that's perfectly fine. smegmaxrpl.com Password: Agamemnox890
Agamemno Posted Tuesday at 05:40 PM Author Posted Tuesday at 05:40 PM If it's too complicated, can anyone steer me in the right direction of a site or service that can help me with this? Thank you.
tuanphan Posted Thursday at 12:04 AM Posted Thursday at 12:04 AM I don't have code for hover, but if click image > play audio, I can provide code. Agamemno 1 Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)
Agamemno Posted Thursday at 05:23 PM Author Posted Thursday at 05:23 PM 17 hours ago, tuanphan said: I don't have code for hover, but if click image > play audio, I can provide code. yeah please can you provide?
tuanphan Posted Friday at 03:23 AM Posted Friday at 03:23 AM 9 hours ago, Agamemno said: yeah please can you provide? You can follow these #1. First, you need to find Image Block In my example, it is: #block-027422632c7a0dd099da #2. Use this code to Code Injection > Footer <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> <script> $(document).ready(function () { let audio = new Audio('https://www.w3schools.com/tags/horse.ogg'); let isPlaying = false; $('#block-027422632c7a0dd099da').click(function () { if (isPlaying) { audio.pause(); } else { audio.play(); } isPlaying = !isPlaying; }); audio.onended = function () { isPlaying = false; }; }); </script> #3. Remember to replace Image Block ID + Audio URL Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)
Agamemno Posted Friday at 06:05 AM Author Posted Friday at 06:05 AM (edited) 2 hours ago, tuanphan said: You can follow these #1. First, you need to find Image Block In my example, it is: #block-027422632c7a0dd099da #2. Use this code to Code Injection > Footer <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> <script> $(document).ready(function () { let audio = new Audio('https://www.w3schools.com/tags/horse.ogg'); let isPlaying = false; $('#block-027422632c7a0dd099da').click(function () { if (isPlaying) { audio.pause(); } else { audio.play(); } isPlaying = !isPlaying; }); audio.onended = function () { isPlaying = false; }; }); </script> #3. Remember to replace Image Block ID + Audio URL So it worked for every image that sends you to an external site. However, for some reason, it does not work for images that send you to pages within the website itself. For example, for the "about me" button (image) that takes you to the "about me" page within the site it does not work. Same for the pre-sale Image that takes you to the Presale page within the site. Edited Friday at 06:06 AM by Agamemno
Solution tuanphan Posted Friday at 07:55 AM Solution Posted Friday at 07:55 AM Try remove link from image and check again If it still doesn't work, you can send exact code you added, I can check easier Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)
Agamemno Posted Friday at 08:16 AM Author Posted Friday at 08:16 AM (edited) Ok, so it technically is working now for the images that go to the pages inside of the website but, since it's not loading an external page, it cuts the sound off almost immediately to load the next page. Edited Friday at 08:26 AM by Agamemno
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment