fastadmin里面播放声音插件

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u010261924/article/details/81139097
(function (factory) {
    if (typeof define === 'function' && define.amd) {
        // AMD. Register as anonymous module.
        define(['jquery'], factory);
    } else if (typeof exports === 'object') {
        // Node / CommonJS
        factory(require('jquery'));
    } else {
        // Browser globals.
        factory(jQuery);
    }
})(function ($) {
  'use strict';
  var types = ['notice', 'warning', 'error', 'success'];
	var audio;

	var settings = {
		inEffect: {
			opacity: 'show'
		},
		inEffectDuration: 100,
		stay: 5000,
		sticky: false,
		type: 'notice',
		position: 'top-right',
		sound: null
	};
  var notify = {
      show:function(){
          $('audio').remove();
          var audioElementHovertree = $('<audio></audio>');
          $("body").append(audioElementHovertree);
          audioElementHovertree.attr('src', '/assets/img/classic.mp3');
          audioElementHovertree.attr('autoplay', 'autoplay'); //打开自动播放
          //audioElement.load();
      }
  };
  return notify;
});

没有jquery.notify那么专业,不过可以用。

猜你喜欢

转载自blog.csdn.net/u010261924/article/details/81139097