Giter Site home page Giter Site logo

jpage's Introduction

JPage

这是一个使用原生 js 实现的分页插件

使用方法

1.首先引入 css 和 js 文件

2.调用构造函数 new JPage() 即可

效果图如下

效果图

可fork项目运行html查看效果

具体使用方法可查看 html 文件,

构造函数具体参数如下:

/*
//默认配置
{
    container:'body',   //类名选择器,不填则默认把插件添加到body末尾,
    pageConfig: {
        current: 1,//当前页
        amount: 10,  //页码总数
        showNumber: 3,    //显示的页码个数
    }
}
*/

//具体代码
let page = new JPage({
    container: '.container',
    pageConfig: {
        current: 1,//当前页
        amount: 15,  //页码总数
        showNumber: 3,    //显示的页码个数
    }
})

//监听页数切换
page.onPageChange = currentPage => {
    console.log('当前页为:', currentPage)
}

如果需要修改样式,直接使用类名修改即可,如修改下一页按钮样式: #page .next-btn{ 具体样式 }

此外,插件也提供了 setStyle 函数进行修改,用法如下:

page.setStyle('.next-btn',{
    color:'red'
})

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.