easyAudioEffects是一款jquery音频特效插件

easyAudioEffects是一款jquery音频特效插件

easyAudioEffects是一款jquery音频特效插件,可以将html dom元素设置音效,触发事件为多种。

使用方式:

第一步引入bfwone 加载依赖项jquery

<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery.easyaudioeffects.js"></script>

第二步配置参数

设置音频文件

$('.selector').easyAudioEffects({
   ogg : "/path/to/sound.ogg",
   mp3 : "/path/to/sound.mp3"
});

配置参数

可用的选项

ParameterTypeDefault valueDescription
oggstringnonet音乐文件路径url
mp3stringnone音乐文件路径url
eventTypestring"hover"设置触发事件 "hover" or "click"
playTypestring"oneShotPolyphonic"设置播放循环模式 "oneShotPolyphonic" , "oneShotMonophonic" , "gate" or"loop"

示例代码

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>BFW NEW PAGE</title>
    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery-3.2.1.min.js"></script>
    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery.easyaudioeffects.js"></script>
    <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/font-awesome-4.7.0/css/font-awesome.min.css">

</head>
<body>
    <div id="trigger-1-click">
        <p>
            鼠标悬浮试试!
        </p>
        <div>
            <i class="fa fa-volume-up fa-lg"></i>
        </div>
    </div>
    <div id="trigger-2-click">
        <p>
            点击试试!
        </p>
        <div>
            <i class="fa fa-volume-up fa-lg"></i>
        </div>
    </div>
    <script>
        $('#trigger-1-click').easyAudioEffects({

            mp3: "//repo.bfw.wiki/bfwrepo/sound/5d7caa4c450fd.mp3",
            eventType: "hover",
            playType: "oneShotPolyphonic"
        });
        $('#trigger-2-click').easyAudioEffects({

            mp3: "//repo.bfw.wiki/bfwrepo/sound/5d7cda8ece598.mp3",
            eventType: "click",
            playType: "oneShotPolyphonic"
        });
    </script>
</body>
</html>



立即下载easyaudioeffects.js查看所有js插件

网友评论0

程序员在线工具箱