Giter VIP home page Giter VIP logo

lightbox's Introduction

lightbox图片画廊全屏预览插件

引入文件

link rel="stylesheet" type="text/css" href="lightbox.css"

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="lightbox.js"></script>

在html元素内定义相应的属性开启功能

1.class="js-lightbox"表示这个元素要启用lightbox
2.data-role="lightbox"表示这个元素要启用lightbox
3.data-source="images/2-1.jpg" 原图的地址
4.data-group="group-2"标识当前是否属于一个组别
5.data-id="ghfh"图片的唯一标识
6.data-caption="nghnhg"当前图片的描述文字

在单个元素上启用(保持这个元素的data-group和data-id唯一)

<img
class="js-lightbox"
data-role="lightbox"
data-source="images/1-1.jpg"
src="images/1-1.jpg"
data-group="group-1"
data-id="kwhdiuqwdhiu"
data-caption="这么美的风景,是否让你窒息!"
width="100"
height="100"
/>

给一组元素应用画廊(保持data-group相同)

一组图片
<img
class="js-lightbox"
data-role="lightbox"
data-group="group-2"
data-caption="俄方未婚夫而更为富人前无古人后突然威风威风"
data-id="sdfsdfw"
data-source="images/2-1.jpg"
src="images/2-1.jpg"
width="100px"
height="100px"
/> <img
class="js-lightbox"
data-role="lightbox"
data-group="group-2"
data-caption="俄方未婚夫但如果热过头热狗热管威风威风"
data-id="fgdgre"
data-source="images/2-2.jpg"
src="images/2-2.jpg"
width="100px"
height="100px"
/>

创建图片画廊

<script>
$(function() {
var lightbox = new LightBox({
speed: 300,
maxWidth: 900,
maxHeight: 600,
maskOpacity: 0.04
});
});
</script>

lightbox's People

Contributors

yangliulang avatar yangyongbiubiu avatar

Stargazers

 avatar  avatar

Watchers

James Cloos avatar  avatar

Forkers

kule2018

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.