代码区项目交易流程

Onclick view large image javascript or CSS3


I have code something like this

<img width="250" height="220" src="img/port1.png" class="wp-post-image" alt="1" /> <a href="">View Large Image</a> <img width="250" height="220" src="img/port1.png" class="wp-post-image" alt="1" /> <a href="">View Large Image</a> <img width="250" height="220" src="img/port1.png" class="wp-post-image" alt="1" /> <a href="">View Large Image</a>

When we click on view large image link , Image should be display large and not disturb other images location.

Problem courtesy of: bigtechideas

Solution

http://lokeshdhakar.com/projects/lightbox2/releases/lightbox2.6.zip

PART 1 - GET SETUP

1.Download and unzip the Lightbox from above.

2.Look inside the js folder to find jquery-1.10.2.min.js and lightbox-2.6.min.js and load both of these files from your html page. Load jQuery first:

<script src="js/jquery-1.10.2.min.js"></script> <script src="js/lightbox-2.6.min.js"></script>

3.Look inside the css folder to find lightbox.css and load it from your html page:

<link href="css/lightbox.css" rel="stylesheet" />

4.Look inside the img folder to find close.png, loading.gif, prev.png, and next.png. These files are used in lightbox.css. By default, lightbox.css will look for these images in a folder called img.

------------------------------------------------------------------------------------------

PART 2 - TURN IT ON

1.Add a data-lightbox attribute to any image link to activate Lightbox. For the value of the attribute, use a unique name for each image. For example:

<a href="img/image-1.jpg" data-lightbox="image-1" title="My caption">image #1</a>

Optional: Set the title attribute if you want to show a caption.

2.If you have a group of related images that you would like to combine into a set, use the same data-lightbox attribute value for all of the images. For example:

<a href="img/image-2.jpg" data-lightbox="roadtrip">image #2</a> <a href="img/image-3.jpg" data-lightbox="roadtrip">image #3</a> <a href="img/image-4.jpg" data-lightbox="roadtrip">image #4</a>

Solution courtesy of: AmanS

本文前端(javascript)相关术语:javascript是什么意思 javascript下载 javascript权威指南 javascript基础教程 javascript 正则表达式 javascript设计模式 javascript高级程序设计 精通javascript javascript教程

点击收藏

LAST Android Client and Node.js Server Making functions unsafe_ NEXT