Giter Site home page Giter Site logo

jstool's Introduction

JStool

放一些自己写过的JS~

1.customAudio

自定义H5音乐播放器样式。 基于jquery

//参数设置
var param ={
    $audioBox:$('#Audio1'),//整个音乐播放器的id
    play:'.play-pause', //播放按钮
    iconPlay:'div',//播放按钮样式的元素
    cssPause:'icon-pause', //播放样式类名
    cssPlay:'icon-play',  //暂停样式类名
    pgsBtn:'.pgs-progress',  //进度条拖拽按钮
    pgsBg:'.pgs', //进度背景条类名
    pgsShow:'.pgs-play', //进度显示条类名
    timeTag:'.audio-time', //总时长标签类名
    currentTime:'.played-time',//已播放时长标签类名
    changePlayBtn:function($obj) {
        // 改播放按钮状态为待播放
        if($obj==undefined) return;
        // $obj.removeClass(this.cssPause).addClass(this.cssPlay);
        $obj.removeClass(this.cssPause).addClass(this.cssPlay);
    },
    changePauseBtn:function() {
        // 改播放按钮状态为待暂停
        this.$audioBox.find(this.play).children(this.iconPlay).removeClass(this.cssPlay).addClass(this.cssPause);
    },
    changePgs:function(value) {
        // 更改进度条样式
        this.$audioBox.find(this.pgsShow).css('width',value+ '%');
    },
    changeCurrentTime:function(time) {
        // 更新播放时间
        this.$audioBox.find(this.currentTime).html(time);
    },
    changeTimeTag:function(audio) {
        // 更新总时长
        this.$audioBox.find(this.timeTag).text(common.transTime(audio.duration));
    }
};

\\调用
MyAudio.run({$audioBox:$('#Audio1')});

jstool's People

Contributors

egoyang avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.