Giter Club home page Giter Club logo

jquery.imagebox.js's Introduction

jquery.imagebox.js

A jquery plugin, dependencies fancybox

项目开发中遇到图库CRUD界面,于是模仿了QQ空间的布局。

示例图片 示例图片 示例图片

默认只需要一个可以返回JOSN格式报文的请求地址。

$('#test_div').imagebox({
			'requestUrl':'http://your-server/your_json_list.json'
});

JSON格式默认如下

{
    "rows": [
        {
            "id": 1,
            "description": "凤竹村",
            "url": "http://yjcun-village.oss-cn-hangzhou.aliyuncs.com/1.jpg"
        },
        {
            "id": 2,
            "description": "蓝玉村",
            "url": "http://yjcun-village.oss-cn-hangzhou.aliyuncs.com/2.jpg"
        },
        {
            "id": 3,
            "description": "马排村",
            "url": "http://yjcun-village.oss-cn-hangzhou.aliyuncs.com/3.jpg"
        },
        {
            "id": 4,
            "description": "沙州村",
            "url": "http://yjcun-village.oss-cn-hangzhou.aliyuncs.com/4.jpg"
        },
        {
            "id": 5,
            "description": "冠洲村",
            "url": "http://yjcun-village.oss-cn-hangzhou.aliyuncs.com/5.jpg"
        }
    ]
}

当然如果你的服务端返回不同的字段,也允许在插件中自定义。

$('#test_div').imagebox({
			'requestUrl':'http://your-server/your_json_list.json',
			'idField' : 'your_id',
			'urlField' : 'your_url',
			'descriptionField' : 'your_description'
});

对应于你的报文如下:

{
    "rows": [
        {
            "your_id": 1,
            "your_description": "凤竹村",
            "your_url": "http://yjcun-village.oss-cn-hangzhou.aliyuncs.com/1.jpg"
        }
    ]
}

其它自定义的写法查看下代码也不难理解。

接下来我想实现: $('#test_div').imagebox('reload');但是不知道该如何编码,希望得到大家的帮助。 我的邮箱是[email protected]

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.