the-muda-organization/vimeo-lazyload
Composer 安装命令:
composer require the-muda-organization/vimeo-lazyload
包简介
LazyLoad Embed Vimeo Player - simple and lightweight plugin - pure JavaScript
README 文档
README
LazyLoad Embed Vimeo Player - simple and lightweight plugin - pure JavaScript
Status
View Preview
Table of contents
- Status
- Quick Start
- What's included
- Bugs and feature requests
- Installation
- How to Use
- Features
- CSS Classes
- FAQ
- Versioning
- Changelog
- Team
- Code of Conduct
- Copyright and License
Quick Start
Several options are available:
- Download the latest release.
- Clone the repo:
git clone https://github.com/the-muda-organization/vimeo-lazyload.git - Install with Composer:
composer require the-muda-organization/vimeo-lazyload
What's included
Within the download you'll find the following directories and files, logically grouping common assets and providing both compiled and minified variations. You'll see something like this:
There are no dependencies. No jQuery or other plugins required. See below for Installation Guide and How to Use
vi-lazyload/
│
└─ dist/
│
├── css/
│ ├── vi-lazyload.css
│ └── vi-lazyload.min.css
│
└── js/
├── vi-lazyload.js
└── vi-lazyload.min.js
Bugs and feature requests
Have a bug or a feature request? Before opening a new issue search for existing and closed issues. If your problem or idea is not addressed yet, open a new issue.
Installation
- Download and copy files to your project
- Open vi-lazyload.js
- Change settings:
settings_thumb_base_urlto custom URL where your thumbnails are located.
- Minify JavaScript and place it in vi-lazyload.min.js.
- Add CSS and JavaScript to your project:
<link href="https://example.com/vi-lazyload/2.x.x/css/vi-lazyload.min.css" rel="stylesheet"> <script src="https://example.com/vi-lazyload/2.x.x/js/vi-lazyload.min.js"></script>
NOTE: Because of small file sizes I recommend adding CSS & JS inline!
<style>...</style> <script>...</script>
How to Use
- Get Vimeo ID of your movie, example:
272532681 - Add the folowing code to embed a video:
<div class="vi-lazyload" data-id="272532681" data-thumb="" data-logo="3"></div>
- Name your thumbnail using Vimeo ID
272532681.jpg- to use other file types change settings in JavaScript - Place your thumbnail in a folder set in JavaScript
Features
| Attribute | Explanation |
|---|---|
class="vi-lazyload" |
Main container. You can add additional style like border, box-shadow etc. or Bootstrap classes like img-thumbnail, shadow etc. |
data-id="272532681" |
Vimeo video ID |
data-thumb="" |
If you need to add more thumbnails you can choose which one is displayed. It is usefull for quality specific thumbs (SD, 720p, 1080p) or in case of multiple thumbs random one can be selected. Name your files 272532681.jpg and add custom suffix.For 3 thumbnails make 272532681--1.jpg, 272532681--2.jpg and 272532681--3.jpg.To show thumbnail 2 use data-thumb="--2" and so on.You can randomize numbers using <?php echo mt_rand(1,3);?>.Leave empty if you have only 1 thumbnail. |
data-logo="3" |
Vimeo logo color. You can customize it in CSS. 0 = none - logo will not be added by JavaScript, 1 = blue, 2 = dark, 3 = white. |
CSS Classes
| CSS class | Explanation |
|---|---|
.vi-lazyload |
main container |
.vi-lazyload::before |
pseudo-element used to maintain container ratio and set background-color |
.vi-lazyload-wrap |
container and its content added via javascript |
.vi-lazyload-content |
container for play button, logo and thumbnail as background-image |
.vi-lazyload-playbtn |
play button (black) |
.vi-lazyload-playbtn:hover |
play button on hover (blue) |
.vi-lazyload-logo |
Vimeo logo |
.vi-lazyload-logo:hover |
Vimeo logo on hover |
.vi-lazyload[data-logo="X"] .vi-lazyload-logo |
Vimeo logo color based on data attribute |
.vi-lazyload iframe |
Vimeo embeded iframe after click |
FAQ
- Can I use Vimeo domain to get thumbnails?
- Not as easy as on Youtube. Vimeo doesn't use video id for its thumbnails. You need to use Vimeo API to get URL of thumbnail.
- Can I use Vimeo lazyload with other frameworks like Bootstrap?
- Yes you can! There should be no conflict with other frameworks.
- Can I embed video players other than Vimeo?
- Check out our sister project for Youtube Player: https://github.com/the-muda-organization/youtube-lazyload
Versioning
Vimeo LazyLoad will be maintained under the Semantic Versioning guidelines as much as possible. Releases will be numbered with the following format:
<major>.<minor>.<patch>
Changelog
For last releases see detailed CHANGELOG.
Team
Code of conduct
We will behave ourselves if you behave yourselves. For more details see our CODE_OF_CONDUCT.md.
Copyright and license
Code and documentation copyright 2017-2020 The MUDA Organization.
Code released under the MIT License.
the-muda-organization/vimeo-lazyload 适用场景与选型建议
the-muda-organization/vimeo-lazyload 是一款 基于 HTML 开发的 Composer 扩展包,目前已累计 392 次下载、GitHub Stars 达 25, 最近一次更新时间为 2019 年 08 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「css」 「JS」 「HTML5」 「vimeo」 「video」 「lazyload」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 the-muda-organization/vimeo-lazyload 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 the-muda-organization/vimeo-lazyload 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 the-muda-organization/vimeo-lazyload 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
HTML5 support for SilverStripe
CakePHP helper for embedding YouTube and Vimeo videos
A Twig extension to insert css as inline styles with a tag
Caching and compression for Twig assets (JavaScript and CSS).
HTML5 Boilerplate is a professional front-end template for building fast, robust, and adaptable web apps or sites.
The yii2-videojs-widget is a Yii 2 wrapper for the [video.js](http://www.videojs.com/). A JavaScript and CSS library that makes it easier to work with and build on HTML5 video. This is also known as an HTML5 Video Player.
统计信息
- 总下载量: 392
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 25
- 点击次数: 26
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-08-09
