- 浏览: 13764622 次
- 性别:
- 来自: 洛杉矶
-
文章分类
- 全部博客 (1994)
- Php / Pear / Mysql / Node.js (378)
- Javascript /Jquery / Bootstrap / Web (435)
- Phone / IOS / Objective-C / Swift (137)
- Ubuntu / Mac / Github / Aptana / Nginx / Shell / Linux (335)
- Perl / Koha / Ruby / Markdown (8)
- Java / Jsp (12)
- Python 2 / Wxpython (25)
- Codeigniter / CakePHP (32)
- Div / Css / XML / HTML5 (179)
- WP / Joomla! / Magento / Shopify / Drupal / Moodle / Zimbra (275)
- Apache / VPN / Software (31)
- AS3.0/2.0 / Flex / Flash (45)
- Smarty (6)
- SEO (24)
- Google / Facebook / Pinterest / SNS (80)
- Tools (22)
最新评论
-
1455975567:
xuezhongyu01 写道wocan23 写道我想问下那个 ...
Mysql: LBS实现查找附近的人 (两经纬度之间的距离) -
xuezhongyu01:
wocan23 写道我想问下那个111.1是怎么得来的我也看不 ...
Mysql: LBS实现查找附近的人 (两经纬度之间的距离) -
18335864773:
试试 pageoffice 在线打开 PDF 文件吧. pag ...
jquery在线预览PDF文件,打开PDF文件 -
青春依旧:
opacity: 0.5; 个人喜欢这种方式!关于其他css特 ...
css透明度的设置 (兼容所有浏览器) -
July01:
推荐用StratoIO打印控件,浏览器和系统的兼容性都很好,而 ...
搞定网页打印自动分页问题
Wordpress 音频播放器 Wordpress audio player with jQuery
Wordpress audio player with jQuery
How to use Wordpress audio player (standalone version) with jQuery and jQuery SWFObject (progressive enhancement).
<!-- SECTION "Wordpress audio player with jQuery" [1-272] -->
Example 1: basic
HTML
<a class="audio" href="audio/reason.mp3"> Audio: An Electronic Reason </a>
Javascript
<!-- SECTION "Example 1: basic" [273-705] -->
$('.audio').each(function(){ audio_file = $(this).attr('href'); $(this).flash( { swf: 'flash/audioplayer.swf', flashvars: { soundFile: audio_file } } ); });
Example 2: several synchronized players
Javascript
<!-- SECTION "Example 2: several synchronized players" [706-1488] -->
// close other audio players // called by audio player when click on play button function ap_stopAll(player_id) { $('.audio').each(function(){ if($(this).attr('href') != player_id) { $(this).find('object')[0].SetVariable("closePlayer", 1); } else { $(this).find('object')[0].SetVariable("closePlayer", 0); } }); } $(document).ready(function() { $('.audio').each(function(){ audio_file = $(this).attr('href'); $(this).flash( { swf: 'flash/audioplayer.swf', flashvars: { playerID: "'" + audio_file + "'", soundFile: audio_file } } ); }); });
Notes
How it works:
-
players are given an id upon initialization
-
when click on play button, player calls
ap_stopAll()
with its id as parameter -
ap_stopAll(): stops all players but the one with this id
-
the id here is the audio file path, but anything else is possible.
<!-- SECTION "Notes" [1489-1786] -->
Example 3: real world
HTML
<p> <a class="audio" href="audio/reason.mp3" id="reason"> Audio: An Electronic Reason </a> </p> <p> <a class="audio" href="audio/sunday.mp3" id="sunday"> Audio: By Sunday Afternoon </a> </p>
Javascript
// close other audio players // called by audio player when click on play button function ap_stopAll(player_id) { $('.audio_flash').each(function(){ if($(this).attr('id') != player_id) { $(this).find('object')[0].SetVariable("closePlayer", 1); } else { $(this).find('object')[0].SetVariable("closePlayer", 0); } }); } $(document).ready(function() { $('.audio').each(function() { audio_file = $(this).attr('href'); audio_title = $(this).text(); audio_id = $(this).attr('id'); div = $('<div class="audio_flash" id="' + audio_id + '"></div>'); $(this).after(div); $(this).after(audio_title); $(this).remove(); div.flash( { swf: 'flash/audioplayer.swf', flashvars: { soundFile: audio_file, playerID: "'" + audio_id + "'", quality: 'high', lefticon: '0xFFFFFF', righticon: '0xFFFFFF', leftbg: '0x357CCE', rightbg: '0x32BD63', rightbghover: '0x2C9D54', wmode: 'transparent' }, height: 50 } ); }); });
<!-- SECTION "Example 3: real world" [1787-3238] -->
Notes
-
meaningful HTML: visitors without Javascript get a download link, otherwise it's replaced by plain text and the player
-
the appearance can be customized with many options (bottom of the page).
-
the default white space before and after the player is reduced by the “height” Flash parameter.
-
use of a custom id (set on the HTML link)
<!-- SECTION "Notes" [3239-3682] -->
Download
<!-- SECTION "Download" [3683-] -->
- jquery_audio_player.zip (1.4 MB)
- 下载次数: 55
发表评论
-
使用jQuery和Pure.CSS创建一个可编辑的表格
2016-08-26 02:24 1314使用开源组件真的可以 ... -
2016十大优秀jQuery插件推荐
2016-08-26 02:24 2405当有限的开发知识限制了设计进展,你无法为自己插上创新的翅膀时 ... -
jQuery .tmpl() 用法
2016-08-26 02:22 1283参考效果: DEMO 下载: jquery-tmpl-ma ... -
jQuery:从零开始,DIY一个jQuery(2)
2016-08-19 03:06 1119在上篇文章我们简单实 ... -
jQuery:从零开始,DIY一个jQuery(1)
2016-08-19 03:00 1055从本篇开始会陪大家一起从零开始走一遍 jQuery 的奇妙旅 ... -
Bootstrap 3: 菜单居中 Center content in responsive bootstrap navbar
2016-08-18 06:15 1664先看上面图片的效果,下面是代码: .navbar .nav ... -
jQuery: 操作select option方法集合
2016-08-18 06:06 3414每一次操作select的时候,总是要谷歌一下资料,真是太不爽 ... -
jQuery: 插件开发模式详解 $.extend(), $.fn, $.widget()
2016-08-16 05:31 1282原文:http://www.codeceo.com/arti ... -
jQuery: 选择器(DOM,name,属性,元素)
2016-08-11 01:17 4559出处:http://www.cnblogs.com/star ... -
jQuery: 合并表格中相同文本的相邻单元格
2016-08-01 08:02 1421一、效果 二、代码 <!DOCTYPE ... -
Bootstrap 3: 使用注意box-sizing细节及解决方法
2016-08-01 07:58 1646一、bootstrap样式 在Bootstrap v3.3 ... -
域名详解
2016-07-29 12:51 929域名 域名就是用来唯 ... -
Bootstrap 3: 图标转换事件 Change icons when toggle
2016-07-20 13:39 2359代码: <link href="http: ... -
Bootstrap 3: 图标转换事件 Change icons when toggle
2016-07-19 07:12 795代码: <link href=" ... -
jQuery:无限循环两个或者多个事件 click / toggle between two functions
2016-07-19 07:12 1679插件: (function($) { $.fn. ... -
javascript 中面向对象实现 如何继承
2016-07-14 01:01 586上一篇博客已经说了关于javascript中的封装, 其中也 ... -
javascript 中的面向对象实现 如何封装
2016-07-12 12:27 1263javascript 是一门很灵活的语言,也是一门有缺陷的语 ... -
AngularJS jQuery 共存法则
2016-06-14 05:26 3670寻找正确的方法,如何在AngularJS里使用jQuery ... -
七步从Angular.JS菜鸟到专家(3):数据绑定和AJAX
2016-06-04 05:28 1205AngularJS学习列表:七步 ... -
七步从Angular.JS菜鸟到专家(2):Scopes
2016-06-04 05:27 751AngularJS学习列表:七步走 Angular.js 从 ...
相关推荐
**WordPress ++++html5音频播放器** 在WordPress中集成HTML5音频播放器是现代网站增强用户体验的一个重要方式,尤其对于音乐分享或者在线电台站点来说,一个功能强大的HTML5音频播放器能够提供无缝的音乐播放体验。...
【标题】"Vanilla-JS-Audio-Player:带有ACF中继器的Vanilla JS音频播放器"是一个使用纯JavaScript编写的音频播放器项目,它利用了Advanced Custom Fields(ACF)插件的中继器功能。这个项目旨在提供一个轻量级且...
McPlayer是一个全功能HTML5 / JS / AJAX音频播放器,带有播放列表和WordPress插件。 描述 McPlayer是使用来自的JS构建的 jQuery的页面过渡不引人注目。 jQueryHTML5音频和视频 带有播放列表和简约视图的Web音频...
可能使用HTML5的`audio`标签或者JavaScript库,如JQuery Audio Player或Howler.js。 4. **AJAX与JavaScript**: AJAX(异步JavaScript和XML)用于无刷新更新内容,提升用户体验。在电台模板中,这可能应用于实时更新...