Skip to main content
Participating Frequently
June 18, 2018
Question

Dreamweaver behaviors

  • June 18, 2018
  • 12 replies
  • 1208 views

Hello,

Is it possible to have more than one behavior initiate at the same time?  Actually, what I am trying to do is have a behavior such as puff happen just before connecting to a link.  Can sound happen along with another behavior?  I'm making a simple game and when the incorrect choice (photo) is chosen, I want to swap a photo with a "Try Again" image and have a sound (preferably one I can record myself) happen onClick (I am doing every behavior onClick).

Any ideas from you extraordinary minds?

Thanks in advance,

Robert

This topic has been closed for replies.

12 replies

WolfShade
Legend
June 18, 2018

As far as the sound part of your question, take a look at this JSFIDDLE.  As long as the user is using a recent browser, this will work for that part.

V/r,

^ _ ^

scorbobbyAuthor
Participating Frequently
June 19, 2018

Thank you for getting back to me.

I know how to add audio to a site, but I have a specific question

concerning having audio render when I want to connect to another page by

link. My linking happens so fast (immediate)that I don't know how to

delay it long enough to have sound before...have the sound render before it

links.

But Mahalo for your comment.

Robert

On Tue, Jun 19, 2018 at 12:14 AM, WolfShade <forums_noreply@adobe.com>

WolfShade
Legend
June 19, 2018

Are you using jQuery? 

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

<audio controls id="aH">
  <source src="http://www.w3schools.com/html/horse.ogg" type="audio/ogg">
  <source src="http://www.w3schools.com/html/horse.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>

<a href="anotherpage.html" class="soundBefore">CLICK</a>

{load jquery before closing HTML tag}

<script>

     $('.soundBefore').click(function(e){

          e.preventDefault();

          $('#aH').play();

          setTimeout(function(){

               window.location.href = $(this).attr('href');

               },3000);// 3 seconds

               }

          );

</script>

Untested, but it should work.  Set the timeout to however long the audio is.

HTH,

^ _ ^