lory

使用 JavaScript 编写的触摸式简约滑块。「☀ Touch enabled minimalistic slider written in vanilla JavaScript.」

  • 所有者: loryjs/lory
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

Please visit: http://loryjs.github.io/lory/

Touch enabled minimalistic slider written in vanilla JavaScript.

license
npm
CDNJS
jsDelivr Hits

build
devDependencies
js-standard-style

Join the chat at https://gitter.im/loryjs/lory
semantic-release
Commitizen friendly

Download

lory is released under the MIT license & supports modern environments.
There is also a prebundled CDN version which you can use.

CDN: https://cdnjs.com/libraries/lory.js/

Install with yarn:

yarn add lory.js

Consume it as an ES2015 module:

import { lory } from 'lory.js';

document.addEventListener('DOMContentLoaded', () => {
    const slider = document.querySelector('.js_slider');

    lory(slider, {
        // options going here
    });
});

Consume it as an commonJS module:

var lory = require('lory.js').lory;

document.addEventListener('DOMContentLoaded', function() {
    var slider = document.querySelector('.js_slider');

    lory(slider, {
        // options going here
    });
});

Install with bower

bower install lory --save

Local development

// To install dev dependencies run:

yarn

// To start the development server run:

yarn run dev

// To lint your code run:

yarn run lint

// To make a full new build run:

yarn run build

Run tests

// To install dev dependencies run:

yarn install

// To start the karma tests locally run:

yarn run karma-local

Prerequisited markup

<div class="slider js_slider">
    <div class="frame js_frame">
        <ul class="slides js_slides">
            <li class="js_slide">1</li>
            <li class="js_slide">2</li>
            <li class="js_slide">3</li>
            <li class="js_slide">4</li>
            <li class="js_slide">5</li>
            <li class="js_slide">6</li>
        </ul>
    </div>
</div>

Prerequisited css

/**
 * (optional) define here the style definitions which should be applied on the slider container
 * e.g. width including further controls like arrows etc.
 */
.slider {
}

.frame {
    /**
     * (optional) wrapper width, specifies width of the slider frame.
     */
    width: 880px;

    position: relative;
    font-size: 0;
    line-height: 0;
    overflow: hidden;
    white-space: nowrap;
}

.slides {
    display: inline-block;
}

li {
    position: relative;
    display: inline-block;

    /**
     * (optional) if the content inside the slide element has a defined size.
     */
    width: 880px;
}

Integration

<script src="js/lory.min.js"></script>
<script>
    'use strict';

    document.addEventListener('DOMContentLoaded', function() {
        var slider = document.querySelector('.js_slider');

        lory(slider, {
            // options going here
        });
    });
</script>

Integration as a jQuery Plugin

<script src="dist/jquery.lory.js"></script>
<script>
    'use strict';

    $(function() {
        $('.js_slider').lory({
            infinite: 1
        });
    });
</script>

Integration of multiple sliders on one page

<script src="dist/lory.js"></script>
<script>
    'use strict';

    document.addEventListener('DOMContentLoaded', function() {
        Array.prototype.slice.call(document.querySelectorAll('.js_slider')).forEach(function (element, index) {
            lory(element, {});
        });
    });
</script>

Public API

Options

Events

Getting Help

Please, do not open issues for general support questions as we want to keep GitHub issues for bug reports and feature requests. You've got much better chances of getting your question answered on StackOverflow where maintainers are looking at questions tagged with loryJS.

StackOverflow is a much better place to ask questions since:

  • There are hundreds of people willing to help on StackOverflow
  • Questions and answers stay available for public viewing so your question / answer might help someone else
  • The StackOverflow voting system assures that the best answers are prominently visible.

To enforce this rule will be systematically closing all the issues that are requests for general support and redirecting people to StackOverflow.

Browser Support

  • Chrome

  • Safari

  • FireFox

  • Opera

  • Internet Explorer 10+

  • Internet Explorer 9 (graceful, without transitions + classlistp)

Copyright © 2015 Maximilian Heinz, contributors. Released under the MIT License

主要指標

概覽
名稱與所有者loryjs/lory
主編程語言JavaScript
編程語言HTML (語言數: 3)
平台
許可證MIT License
所有者活动
創建於2015-03-15 17:28:41
推送於2022-12-06 23:15:20
最后一次提交2019-01-19 16:15:30
發布數70
最新版本名稱v2.5.3 (發布於 )
第一版名稱v0.1.0 (發布於 2015-03-20 15:06:12)
用户参与
星數2.3k
關注者數56
派生數242
提交數783
已啟用問題?
問題數144
打開的問題數17
拉請求數292
打開的拉請求數25
關閉的拉請求數333
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?