Responsive-Lightbox

Lightweight, image only responsive, jQuery lightbox plugin

  • 所有者: duncanmcdougall/Responsive-Lightbox
  • 平台:
  • 许可证:
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

Responsive-Lightbox

by Duncan McDougall, @duncanmcdougall

jQuery responsive lightbox plugin.

Shrinks the image to the width & height of the browser. Only handles images so it's nice and lightweight.

Demonstration

Responsive Lightbox Demo

Dependencies

Requires jQuery >= 1.4 and < 3

Browser Support

IE7+

Usage

<html>
<head>
<link rel="stylesheet" href="lightbox.css" />
</head>
<body>
<!-- Link to the image -->
<div class="gallery">
<a href="photo1.jpg">Image 1</a>
<a href="photo2.jpg">Image 2</a>
</div>

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="lightbox.min.js"></script>

<script>
 $(function()
 {
    $('.gallery a').lightbox(); 
	
	// If you want seperate galleries on the same page
	// just specify different class names. 
	$('.gallery-2 a').lightbox();
 });
</script>
</body>

Options

    $('.gallery').lightbox({ margin: 20, nav: false, blur: true, minSize: 480 });
  • margin - int - default 50. Minimum margin around the image
  • nav - bool - default true. enable navigation
  • blur - bool - default true. Blur other content when open using css filter
  • minSize - int - default 0. Min window width or height to open lightbox. Below threshold will open image in a new tab.

Captions

Add your captions as a data attribute to the anchor. e.g.

    <a href="myimage.jpg" data-caption="This is a picture of a cat" >

Installing with Bower

If bower is your thing you can install using the following command

bower install responsive-lightbox

Contributing

First, clone a copy of using the GUI or the main git repo by running:

git clone git://github.com/duncanmcdougall/Responsive-Lightbox.git

I'm using GruntJS to do all the minification and linting as build tasks.

Install the grunt-cli package so that you will have the correct version of grunt available from any project that needs it. This should be done as a global install:

npm install -g grunt-cli

Enter the jquery directory and install the Node dependencies, this time without specifying a global install:

cd Responsive-Lightbox && npm install

Make sure you have grunt installed by testing:

grunt -version

Then, to get a complete, minified (w/ Uglify.js), linted (w/ JSHint) version of the plugin, type the following:

grunt

The built version of the plugin will be saved to .min versions.

Next Steps

  • Options: { loop }
  • Faster image switching
  • Light and dark simple themes

Thanks To

I'd like to thank Matthew Hartman, imiric et all for contributing a number of improvements to the lightbox.

MIT License

This plugin is released under the MIT License. Enjoy.

主要指标

概览
名称与所有者duncanmcdougall/Responsive-Lightbox
主编程语言JavaScript
编程语言JavaScript (语言数: 4)
平台
许可证
所有者活动
创建于2012-11-13 23:50:11
推送于2020-11-30 16:15:22
最后一次提交2020-11-30 16:08:38
发布数6
最新版本名称v1.4.1 (发布于 )
第一版名称v1.0 (发布于 )
用户参与
星数113
关注者数12
派生数47
提交数74
已启用问题?
问题数26
打开的问题数8
拉请求数7
打开的拉请求数0
关闭的拉请求数4
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?