Advertisement
Guest User

Untitled

a guest
Aug 31st, 2015
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!-- =========================
  2.     AUDIO JAVASCRIPT
  3.     ========================= -->
  4.         <script type="text/javascript" src="js/soundmanager2.js"></script>
  5.  
  6.         <!-- configure SM2 for your use -->
  7.         <script type="text/javascript">
  8.         soundManager.setup({
  9.  
  10.           // location: path to SWF files, as needed (SWF file name is appended later.)
  11.  
  12.           url: '/path/to/swf-files/',
  13.  
  14.           // optional: version of SM2 flash audio API to use (8 or 9; default is 8 if omitted, OK for most use cases.)
  15.           // flashVersion: 9,
  16.  
  17.           // use soundmanager2-nodebug-jsmin.js, or disable debug mode (enabled by default) after development/testing
  18.           // debugMode: false,
  19.  
  20.           // good to go: the onready() callback
  21.  
  22.           onready: function() {
  23.  
  24.             // SM2 has started - now you can create and play sounds!
  25.  
  26.             var mySound = soundManager.createSound({
  27.               id: 'book', // optional: provide your own unique id
  28.               url: 'audio/book.wav'
  29.               // onload: function() { console.log('sound loaded!', this); }
  30.                
  31.              // other options here..
  32.             });
  33.             var beep = soundManager.createSound({
  34.               id: 'bleep', // optional: provide your own unique id
  35.               url: 'audio/effect/bleep.wav'
  36.               // onload: function() { console.log('sound loaded!', this); }
  37.                
  38.              // other options here..
  39.             });
  40.             var cheer = soundManager.createSound({
  41.               id: 'cheer', // optional: provide your own unique id
  42.               url: 'audio/effect/cheer.wav'
  43.               // onload: function() { console.log('sound loaded!', this); }
  44.                
  45.              // other options here..
  46.             });
  47.  
  48.             setTimeout(function () { mySound.play(); }, 3000);
  49.             },
  50.  
  51.           // optional: ontimeout() callback for handling start-up failure
  52.  
  53.           ontimeout: function() {
  54.  
  55.             // Hrmm, SM2 could not start. Missing SWF? Flash blocked? No HTML5 audio support? Show an error, etc.?
  56.             // See the flashblock demo when you want to start getting fancy.
  57.  
  58.           }
  59.        
  60.         });
  61.         function cheer(){cheer.play();}
  62.         function bleep(){beep.play();}
  63.         </script>
  64. <body>
  65. <center>
  66.             <a href="#book" onclick="cheer()"><img class="heroshot wow bounceInUp" data-wow-duration="2s" src="img/book.png" width="15%"></a>
  67.             <a href="#car" onclick="beep()"><img class="heroshot wow bounceInDown" data-wow-duration="3s" src="img/car.png" width="15%"></a>
  68.             <a href="#cat" onclick="beep()"><img class="heroshot wow bounceInUp" data-wow-duration="2s" src="img/cat.png" width="15%"></a>
  69.             <a href="#brain" onclick="beep()"><img class="heroshot wow bounceInDown" data-wow-duration="3s" src="img/brain.png" width="15%"></a>
  70.         </center>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement