jQuery Plugin For Adding Sound Effects To Elements - easyaudioeffects.js

File Size: 736 KB
Views Total: 3153
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
jQuery Plugin For Adding Sound Effects To Elements - easyaudioeffects.js

easyaudioeffects.js is a jQuery plugin for adding sound effects (ogg and mp3) to any html elements that supports custom trigger events and play types.

How to use it:

1. Put jQuery library and the jQuery easyaudioeffects.js script at the bottom of your webpage.

<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="jquery.easyaudioeffects.1.0.0.js"></script>

2. Call the plugin on the target element and specify the paths to the audio files.

$('.button').easyAudioEffects({
  ogg : "sound.ogg",
  mp3 : "sound.mp3"
});

3. By default, the plugin will play the sound effect on hover. You can config the plugin to play the sound effect on click by passing the 'eventType' option during initialization.

$('.button').easyAudioEffects({
  ogg : "sound.ogg",
  mp3 : "sound.mp3",
  eventType : 'click',
});

4. Change the play type to others.

$('.button').easyAudioEffects({
  ogg : "sound.ogg",
  mp3 : "sound.mp3",
  eventType : 'click', // [ hover / click ]
  playType : "gate", // [ oneShotPolyphonic / oneShotMonophonic / gate / loop ]
});

This awesome jQuery plugin is developed by rm-labo. For more Advanced Usages, please check the demo page or visit the official website.