滑动导航和停止音频 [英] Swipe to navigate and stop audio

查看:120
本文介绍了滑动导航和停止音频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要建立使用jQuery-Mobile的其中每一个页面包含一个图像和声音自动播放的应用程序。
当第一页刷卡到下一个页面,第一页的音频停止播放,并在第二页的开始播放。
谁能帮我怎么做,或告知我的插件。

I want to build an app using jQuery-Mobile which every single page contains an image and autoplay audio. when the first page is swiped to the next page, the first page's audio stops playing and the second page's starts playing. Can anyone help me how to do it or inform me a plugin.

在此先感谢!

推荐答案

使用jQuery Mobile的 pagehide pagebeforehide 事件停止音频文件。

Use jQuery Mobile pagehide or pagebeforehide events to stop audio files.

$(document).on('pagebeforehide', function () {
  $(this).find('audio').each(function () {
    $(this)[0].pause();
  });
});

这篇关于滑动导航和停止音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆