Git Product home page Git Product logo

lantern.js's Introduction

Lantern

Mark Simon

Sample

Click Here for the sample …

Introduction

This script is a light-weight light box clone.

To use:

  1. Copy the lantern.js and the lantern.css files somewhere

  2. Around your thumbnail images:

    <a href="..."><img ... alt="…" title="…"></a>
    

    Your href should be the location of the enlarged image. Your img src is probably your thumbnail.

    Your thumbnail images are expected to have an alt attribute. They will also need a title attribute, since this is what will appear as the tile of the image.

  3. Head Section:

    <link rel="stylesheet" type="text/css" href="…/lantern.css"/>
    <script type="text/javascript" src="…/lantern.js"></script>
    <script type="text/javascript">
    	function init() {
    		var options = { … };
    		lantern('div#slides a',options);
    	}
    </script>
    
  4. The selector div#slides a includes tha actual anchor elements which are to be hijacked.

  5. Options are, well, optional. Set them as an abject as follows:

    var options = {
    	background:	'background',	//	id of background
    	div:		'lantern',		//	id of container
    	title:		'title',		//	id of title
    	showing:	'showing',		//	attribute when showing
    	escape:		false,			//	whether responds to escape key
    	delay:		0,				//	delay (ms) before hiding
    
    	//	new
    	dblclick:	false,			//	whether to use double-click
    	draggable:	false,			//	whether to allow dragging
    	callback:		undefined,		//	callback on showing
    	callbackOn:		undefined,		//	callback on both
    	callbackOff:	undefined,		//	callback on hiding
    };
    
  6. The (sample) CSS file comes in three parts. Feel free to tweak as much as you like, but note the following:

    1. The essential CSS required for the effect to work at all.

    2. Some more basic CSS to make it look complete.

    3. Some CSS3 to make the whole thing look spectacular.

      Obviously, the CSS won’t work in Legacy™ Browsers.

Disclaimer

This script probably works and it does what it does.
What it doesn’t do it doesn’t do. E & OE

To do

  1. Incorporate slide show.

  2. Incorporate span for additional descriptive text:

    <a href="..." class="light"><img ... /><span>Description</span></a>
    
  3. Re-consider whether the selector above needs to include the a.

lantern.js's People

Contributors

manngo avatar

Watchers

James Cloos avatar  avatar

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.