Jump to content

Sound Effects on Hover/Click

Recommended Posts

  • 5 months later...

You can play sound effects with some simple JavaScript that reacts to an element being clicked or hovered. For example, the first step will be to upload some sound files to your site (for example, .mp3) using the file upload feature. You'll then be able to play them by referring to their URL - they will appear in the /s/ folder under the site's domain.

To test it is working, you can play the file 'boing.mp3' with this test example:

<script>
  var audio = new Audio('/s/boing.mp3');
  audio.play();
</script>

If you'd like help with code that is triggered when a specific element or type of element is clicked, the community will need a little more information about how you want to trigger these sound effects, and we'll need a link to the site and the file(s) after upload

For example, do you want them to play when a specific element or type of element is clicked? Which one(s)? Do you want the same sound to play every time, or do you want a random effect from a range of sounds?

I hope this gets you started.

Did this help? Please give feedback by clicking an icon below  ⬇️

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.

Link to comment
  • 4 weeks later...
  • 5 months later...

Let's make up a word.  sesquipedalian.  I would like that when a user clicks on that word or hovers over the word the audio for that word would lay.  Much like this google site except the SS player would play the audio.  Although I am now on the business plan, I thought I could just upload the .mp3, get the link for it and that would be that but that does not seem to work.  I'm not sure where to begin on this one.  Any ideas would be great and I buy lots of coffee for folks 😂  😂

Oh, and I did go into chrome inspect and was able to copy out the mp3 link from SS static link which works as a link but it doesn't open on the same page it opens it on a new page (which I would expect). I just want it to play without showing an audio player like on the link below but I will settle for what i can get.

Thanks.

 

https://www.google.com/search?q=sesqupidlian&oq=sesqupidlian&gs_lcrp=EgZjaHJvbWUyBggAEEUYOdIBCDM3ODlqMGo3qAIAsAIA&sourceid=chrome&ie=UTF-8

Edited by MoeTalks
Add notes
Link to comment
7 hours ago, MoeTalks said:

when I try to upload mp3 it says I cannot.

How are you trying to upload it? The file can be added using a Link Editor, as described in Uploading and managing files.

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.