Home > Web Front-end > H5 Tutorial > HTML5 adds mouse hover sound effects without using FLASH_html5 tutorial skills

HTML5 adds mouse hover sound effects without using FLASH_html5 tutorial skills

WBOY
Release: 2016-05-16 15:47:56
Original
1727 people have browsed it

Use HTML5 jQuery, not FLASH:

Browser Applicable Range: Firefox 3.5, Chrome 3, Opera 10.5, Safari 4, IE 9

Code example:

Copy code
The code is as follows:

$("#speak").mouseenter(function(){
$("").attr({
'src':'audio/' Math.ceil(Math.random() * 5) '.mp3',
' volume':0.4,
'autoplay':'autoplay'
}).appendTo("body");
});

The above is the audio element using html5 , randomly plays an mp3 sound effect.

This code demonstration (using jQuery) is from the homepage of goodfootapp.com.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template