GithubHelp home page GithubHelp logo

royanon / angular-lightbox Goto Github PK

View Code? Open in Web Editor NEW

This project forked from abodelot/angular-lightbox

0.0 1.0 0.0 187 KB

A minimal lightbox directive for AngularJS.

License: MIT License

CSS 48.30% HTML 38.11% JavaScript 13.59%

angular-lightbox's Introduction

AngularJS Lightbox

npm npm npm

A minimal lightbox directive for AngularJS. No other dependencies!

Check out the demo page!

Installation

This project is available as npm package angularjs-lightbox:

npm install angularjs-lightbox

Include the directive sources (Javascript and CSS) in your AngularJS application:

<script src="https://code.angularjs.org/1.7.8/angular.min.js"></script>

<script src="angularjs-lightbox/src/angular-lightbox.js"></script>
<link type="text/css" rel="stylesheet" href="angularjs-lightbox/src/angular-lightbox.css">

Usage

Declare an array of image URLs, or a single URL:

var app = angular.module('MyApp', ['angular-lightbox']);

app.controller('MyController',  function($scope) {
  $scope.myImages = ['foobar.png', 'foobaz.jpg', 'barbaz.gif'];

  $scope.imageUrl = 'foobar2.png';
});

In your view, use the lightbox attribute on any element, and use the lightbox-trigger class on any child element to trigger the lightbox opening.

Example for a list:

<ul lightbox="myImages">
  <li ng-repeat="image in myImages">
    <a href="image" class="lightbox-trigger">{{ image }}</a>
  </li>
</ul>

Example for a single image:

<span lightbox="imageUrl">
  <a href class="lightbox-trigger">link</a>
</span>

Keyboard shortcuts

  • Left: Previous image
  • Right: Next image
  • Home: First image
  • End: Last image
  • Escap: Close Lightbox

Dependencies

  • Angularjs >= 1.3

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.